Editar

Compartilhar via


MemoryExtensions.AsBytes<T>(Memory<T>) Method

Definition

Casts a Memory<T> of one primitive type T to Memory<T> of bytes.

public static Memory<byte> AsBytes<T> (this Memory<T> memory) where T : struct;
static member AsBytes : Memory<'T (requires 'T : struct)> -> Memory<byte> (requires 'T : struct)
<Extension()>
Public Function AsBytes(Of T As Structure) (memory As Memory(Of T)) As Memory(Of Byte)

Type Parameters

T

The type if items in the source Memory<T>.

Parameters

memory
Memory<T>

The source Memory<T>, of type T.

Returns

A Memory<T> of bytes.

Exceptions

Thrown if the Length property of the new Memory<T> would exceed MaxValue.

Thrown when the data store of memory is not supported.

Applies to