Memory<T> Yapı
Tanım
Ardışık bir bellek bölgesini temsil eder.Represents a contiguous region of memory.
generic <typename T>
public value class Memory : IEquatable<Memory<T>>
generic <typename T>
public value class Memory
public struct Memory<T> : IEquatable<Memory<T>>
public struct Memory<T>
type Memory<'T> = struct
Public Structure Memory(Of T)
Implements IEquatable(Of Memory(Of T))
Public Structure Memory(Of T)
Tür Parametreleri
- Devralma
- Uygulamalar
-
IEquatable<Memory<T>>
Açıklamalar
Benzer şekilde Span<T> , Memory<T> ardışık bir bellek bölgesini temsil eder.Like Span<T>, Memory<T> represents a contiguous region of memory. Ancak aksine, Span<T> Memory<T> ref structdeğildir.Unlike Span<T>, however, Memory<T> is not a ref struct. Bu, Memory<T> yönetilen yığına yerleştirilebileceği anlamına gelir, ancak bunu yapabilirsiniz Span<T> .This means that Memory<T> can be placed on the managed heap, whereas Span<T> cannot. Sonuç olarak, Memory<T> Yapı bir örnekle aynı kısıtlamalara sahip değildir Span<T> .As a result, the Memory<T> structure does not have the same restrictions as a Span<T> instance. Özellikle:In particular:
Bu, bir sınıfta alan olarak kullanılabilir.It can be used as a field in a class.
Bu,
awaitve sınırları genelinde kullanılabiliryield.It can be used acrossawaitandyieldboundaries.
' A ek olarak Memory<T> , System.ReadOnlyMemory<T> sabit veya salt okunabilir belleği temsil etmek için kullanabilirsiniz.In addition to Memory<T>, you can use System.ReadOnlyMemory<T> to represent immutable or read-only memory.
Oluşturucular
| Memory<T>(T[]) |
Memory<T>Belirtilen dizinin tamamı üzerinde yeni bir nesne oluşturur.Creates a new Memory<T> object over the entirety of a specified array. |
| Memory<T>(T[], Int32, Int32) |
Memory<T>Belirtilen dizinden başlayarak bir dizinin belirtilen sayıda öğesini içeren yeni bir nesne oluşturur.Creates a new Memory<T> object that includes a specified number of elements of an array beginning at a specified index. |
Özellikler
| Empty |
Boş bir Memory<T> nesne döndürür.Returns an empty Memory<T> object. |
| IsEmpty |
Geçerli örneğin boş olup olmadığını gösterir.Indicates whether the current instance is empty. |
| Length |
Geçerli örnekteki öğelerin sayısını alır.Gets the number of items in the current instance. |
| Span |
Geçerli örnekten bir span döndürür.Returns a span from the current instance. |
Yöntemler
| CopyTo(Memory<T>) |
Bir Memory<T> nesnenin içeriğini hedef Memory<T> nesnesine kopyalar.Copies the contents of a Memory<T> object into a destination Memory<T> object. |
| Equals(Memory<T>) |
Belirtilen Memory<T> nesnenin geçerli nesneye eşit olup olmadığını belirler.Determines whether the specified Memory<T> object is equal to the current object. |
| Equals(Object) |
Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.Determines whether the specified object is equal to the current object. |
| GetHashCode() |
Bu örneğe ilişkin karma kodu döndürür.Returns the hash code for this instance. |
| Pin() |
Nesne için bir tanıtıcı oluşturur Memory<T> .Creates a handle for the Memory<T> object. |
| Slice(Int32) |
Belirtilen dizinde başlayan geçerli bellekten bir dilim oluşturur.Forms a slice out of the current memory that begins at a specified index. |
| Slice(Int32, Int32) |
Belirtilen bir dizin için belirtilen bir dizinden başlayarak geçerli bellekten bir dilim oluşturur.Forms a slice out of the current memory starting at a specified index for a specified length. |
| ToArray() |
Bellekteki içerikleri yeni bir diziye kopyalar.Copies the contents from the memory into a new array. |
| ToString() |
Bu nesnenin dize gösterimini döndürür Memory<T> .Returns the string representation of this Memory<T> object. |
| TryCopyTo(Memory<T>) |
Belleğin içeriğini bir hedef Memory<T> örneğine kopyalar.Copies the contents of the memory into a destination Memory<T> instance. |
İşleçler
| Implicit(ArraySegment<T> to Memory<T>) |
Bir nesnenin örtük olarak bir nesnesine dönüştürülmesini tanımlar ArraySegment<T> Memory<T> .Defines an implicit conversion of an ArraySegment<T> object to a Memory<T> object. |
| Implicit(Memory<T> to ReadOnlyMemory<T>) |
Bir nesnenin örtük olarak bir nesnesine dönüştürülmesini tanımlar Memory<T> ReadOnlyMemory<T> .Defines an implicit conversion of a Memory<T> object to a ReadOnlyMemory<T> object. |
| Implicit(T[] to Memory<T>) |
Bir dizinin örtük olarak bir nesnesine dönüştürülmesini tanımlar Memory<T> .Defines an implicit conversion of an array to a Memory<T> object. |
Uzantı Metotları
| Trim<T>(Memory<T>, T) |
Belirtilen öğenin tüm önde gelen ve sondaki oluşumlarını bir bellek bölgesinden kaldırır.Removes all leading and trailing occurrences of a specified element from a memory region. |
| Trim<T>(Memory<T>, ReadOnlySpan<T>) |
Bir bellek bölgesinden salt okunurdur bir yayılma alanında belirtilen bir öğe kümesinin tüm önde gelen ve sondaki oluşumlarını kaldırır.Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a memory region. |
| TrimEnd<T>(Memory<T>, T) |
Bir karakter belleği bölgesinden belirtilen öğenin tüm sondaki oluşumlarını kaldırır.Removes all trailing occurrences of a specified element from a character memory region. |
| TrimEnd<T>(Memory<T>, ReadOnlySpan<T>) |
Bir bellek bölgesindeki salt okunurdur bir yayılma alanında belirtilen öğelerin kümesinin tüm sondaki oluşumlarını kaldırır.Removes all trailing occurrences of a set of elements specified in a read-only span from a memory region. |
| TrimStart<T>(Memory<T>, T) |
Belirtilen öğenin tüm önde gelen oluşumlarını bir bellek bölgesinden kaldırır.Removes all leading occurrences of a specified element from a memory region. |
| TrimStart<T>(Memory<T>, ReadOnlySpan<T>) |
Bir bellek bölgesinden salt okunurdur bir yayılma alanında belirtilen bir öğe kümesinin tüm önde gelen oluşumlarını kaldırır.Removes all leading occurrences of a set of elements specified in a read-only span from a memory region. |