Modifica

Condividi tramite


ReadOnlySpanExtensions.AsBytes<T>(ReadOnlySpan<T>) Method

Definition

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

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

Type Parameters

T

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

Parameters

span
ReadOnlySpan<T>

The source slice, of type T.

Returns

A ReadOnlySpan<T> of bytes.

Exceptions

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

Applies to