MemoryMarshal Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides methods to interoperate with Memory<T>, ReadOnlyMemory<T>, Span<T>, and ReadOnlySpan<T>.
public ref class MemoryMarshal abstract sealed
public static class MemoryMarshal
type MemoryMarshal = class
Public Class MemoryMarshal
- Inheritance
-
MemoryMarshal
Methods
AsBytes<T>(ReadOnlySpan<T>) |
Casts a ReadOnlySpan<T> of one primitive type, |
AsBytes<T>(Span<T>) |
Casts a Span<T> of one primitive type, |
AsMemory<T>(ReadOnlyMemory<T>) |
Creates a Memory<T> instance from a ReadOnlyMemory<T>. |
AsRef<T>(ReadOnlySpan<Byte>) |
Reinterprets a read-only span of bytes as a read-only reference to the structure of type |
AsRef<T>(Span<Byte>) |
Reinterprets a span of bytes as a reference to the structure of type |
Cast<TFrom,TTo>(ReadOnlySpan<TFrom>) |
Casts a read-only span of one primitive type to a read-only span of another primitive type. |
Cast<TFrom,TTo>(Span<TFrom>) |
Casts a span of one primitive type to a span of another primitive type. |
CreateFromPinnedArray<T>(T[], Int32, Int32) |
Creates a new memory buffer over the portion of the pre-pinned target array beginning at the |
CreateReadOnlySpan<T>(T, Int32) |
Creates a new read-only span over a portion of a regular managed object. |
CreateReadOnlySpanFromNullTerminated(Byte*) |
Creates a new read-only span for a null-terminated sequence of bytes. |
CreateReadOnlySpanFromNullTerminated(Char*) |
Creates a new read-only span for a null-terminated string. |
CreateSpan<T>(T, Int32) |
Creates a new span over a portion of a regular managed object. |
GetArrayDataReference(Array) |
Returns a reference to the 0th element of |
GetArrayDataReference<T>(T[]) |
Returns a reference to the 0th element of |
GetReference<T>(ReadOnlySpan<T>) |
Returns a reference to the element of the read-only span at index 0. |
GetReference<T>(Span<T>) |
Returns a reference to the element of the span at index 0. |
Read<T>(ReadOnlySpan<Byte>) |
Reads a structure of type |
ToEnumerable<T>(ReadOnlyMemory<T>) |
Creates an IEnumerable<T> view of the given read-only memory buffer. |
TryGetArray<T>(ReadOnlyMemory<T>, ArraySegment<T>) |
Tries to get an array segment from the underlying memory buffer. The return value indicates the success of the operation. |
TryGetMemoryManager<T,TManager>(ReadOnlyMemory<T>, TManager) |
Tries to retrieve a MemoryManager<T> from the underlying read-only memory buffer. |
TryGetMemoryManager<T,TManager>(ReadOnlyMemory<T>, TManager, Int32, Int32) |
Tries to retrieve a MemoryManager<T>, start index, and length from the underlying read-only memory buffer. |
TryGetString(ReadOnlyMemory<Char>, String, Int32, Int32) |
Tries to get the underlying string from a |
TryRead<T>(ReadOnlySpan<Byte>, T) |
Tries to read a structure of type |
TryWrite<T>(Span<Byte>, T) |
Tries to write a structure of type |
Write<T>(Span<Byte>, T) |
Writes a structure of type |