ReadOnlyMemory<T> ReadOnlyMemory<T> ReadOnlyMemory<T> ReadOnlyMemory<T> Struct

定義

表示連續的記憶體區域,類似於 ReadOnlySpan<T>Represents a contiguous region of memory, similar to ReadOnlySpan<T>. 不同於 ReadOnlySpan<T>,它不是類似 ByRef 的類型。Unlike ReadOnlySpan<T>, it is not a byref-like type.

generic <typename T>
public value class ReadOnlyMemory : IEquatable<ReadOnlyMemory<T>>
public struct ReadOnlyMemory<T> : IEquatable<ReadOnlyMemory<T>>
type ReadOnlyMemory<'T> = struct
Public Structure ReadOnlyMemory(Of T)
Implements IEquatable(Of ReadOnlyMemory(Of T))

類型參數

T

要從中讀取記憶體之連續區域的物件類型。The object type from which the contiguous region of memory will be read.

繼承
ReadOnlyMemory<T>ReadOnlyMemory<T>ReadOnlyMemory<T>ReadOnlyMemory<T>
實作

建構函式

ReadOnlyMemory<T>(T[]) ReadOnlyMemory<T>(T[]) ReadOnlyMemory<T>(T[]) ReadOnlyMemory<T>(T[])

在整個目標陣列上建立新記憶體區域。Creates a new memory region over the entirety of the target array.

ReadOnlyMemory<T>(T[], Int32, Int32) ReadOnlyMemory<T>(T[], Int32, Int32) ReadOnlyMemory<T>(T[], Int32, Int32) ReadOnlyMemory<T>(T[], Int32, Int32)

在起始於指定位置且包含指定元素數的目標陣列部分上建立新記憶體區域。Creates a new memory region over the portion of the target array beginning at a specified position and including a specified number of elements.

屬性

Empty Empty Empty Empty

取得空的 ReadOnlyMemory<T>Gets an empty ReadOnlyMemory<T>.

IsEmpty IsEmpty IsEmpty IsEmpty

取得值,指出這個唯讀記憶體區域是否為空的。Gets a value that indicates whether this read-only memory region is empty.

Length Length Length Length

取得記憶體區域中的項目數。Gets the number of items in the memory region.

Span Span Span Span

從記憶體區域取得範圍。Gets a span from the memory region.

方法

CopyTo(Memory<T>) CopyTo(Memory<T>) CopyTo(Memory<T>) CopyTo(Memory<T>)

將唯讀記憶體區域的內容複製到目的地記憶體區域。Copies the contents of the read-only memory region into a destination memory region.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前唯讀記憶體區域。Determines whether the specified object is equal to the current read-only memory region.

Equals(ReadOnlyMemory<T>) Equals(ReadOnlyMemory<T>) Equals(ReadOnlyMemory<T>) Equals(ReadOnlyMemory<T>)

判斷目前的執行個體和指定的 ReadOnlyMemory<T> 物件是否相等。Determines whether the current instance and a specified ReadOnlyMemory<T> objects are equal.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

傳回這個 ReadOnlyMemory<T> 的雜湊程式碼。Returns the hash code for this ReadOnlyMemory<T>.

Pin() Pin() Pin() Pin()

建立記憶體的控制代碼。Creates a handle for the memory.

Slice(Int32) Slice(Int32) Slice(Int32) Slice(Int32)

從起始於指定位置一直到其結尾的指定記憶體區域形成配量。Forms a slice out of the given memory region, beginning at a specified poisition and continuing to its end.

Slice(Int32, Int32) Slice(Int32, Int32) Slice(Int32, Int32) Slice(Int32, Int32)

從起始於 start 位置且具有 length 個元素的指定記憶體區域形成配量。Forms a slice out of the given memory region starting at start position for length elements.

ToArray() ToArray() ToArray() ToArray()

將記憶體區域的內容複製到新陣列。Copies the contents from the memory region into a new array.

ToString() ToString() ToString() ToString()

傳回這個唯讀記憶體執行個體的字串表示。Returns the string representation of this read-only memory instance.

TryCopyTo(Memory<T>) TryCopyTo(Memory<T>) TryCopyTo(Memory<T>) TryCopyTo(Memory<T>)

嘗試將唯讀記憶體的內容複製到目的地並傳回值,指出複製作業是否成功。Tries to copy the contents of the readonly-only memory into the destination and returns a value that indicates whether the copy operation succeeded.

運算子

Implicit(ArraySegment<T> to ReadOnlyMemory<T>) Implicit(ArraySegment<T> to ReadOnlyMemory<T>) Implicit(ArraySegment<T> to ReadOnlyMemory<T>) Implicit(ArraySegment<T> to ReadOnlyMemory<T>)

定義從 ArraySegment<T>ReadOnlyMemory<T> 的隱含轉換。Defines an implicit conversion of a ArraySegment<T> to a ReadOnlyMemory<T>.

Implicit(T[] to ReadOnlyMemory<T>) Implicit(T[] to ReadOnlyMemory<T>) Implicit(T[] to ReadOnlyMemory<T>) Implicit(T[] to ReadOnlyMemory<T>)

定義從陣列到 ReadOnlyMemory<T> 的隱含轉換。Defines an implicit conversion of an array to a ReadOnlyMemory<T>.

擴充方法

Trim<T>(ReadOnlyMemory<T>, T) Trim<T>(ReadOnlyMemory<T>, T) Trim<T>(ReadOnlyMemory<T>, T) Trim<T>(ReadOnlyMemory<T>, T)

從唯讀記憶體區域中移除所有開頭和尾端指定元素項目。Removes all leading and trailing occurrences of a specified element from a read-only memory region.

Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>)

從唯讀記憶體區域中移除唯讀範圍中指定的所有開頭和尾端元素集項目。Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a read-only memory region.

TrimEnd<T>(ReadOnlyMemory<T>, T) TrimEnd<T>(ReadOnlyMemory<T>, T) TrimEnd<T>(ReadOnlyMemory<T>, T) TrimEnd<T>(ReadOnlyMemory<T>, T)

從唯讀記憶體區域中移除所有尾端指定元素項目。Removes all trailing occurrences of a specified element from a read-only memory region.

TrimEnd<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) TrimEnd<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) TrimEnd<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) TrimEnd<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>)

從唯讀記憶體區域中移除唯讀範圍中指定的所有尾端元素集項目。Removes all trailing occurrences of a set of elements specified in a read-only span from a read-only memory region.

TrimStart<T>(ReadOnlyMemory<T>, T) TrimStart<T>(ReadOnlyMemory<T>, T) TrimStart<T>(ReadOnlyMemory<T>, T) TrimStart<T>(ReadOnlyMemory<T>, T)

從記憶體區域中移除所有開頭指定元素項目。Removes all leading occurrences of a specified element from a memory region.

TrimStart<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) TrimStart<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) TrimStart<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) TrimStart<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>)

從記憶體區域中移除唯讀範圍中指定的所有開頭元素集項目。Removes all leading occurrences of a set of elements specified in a read-only span from a memory region.

適用於