Editar

Compartilhar via


SpanExtensions.AsBytes<T>(Span<T>) Method

Definition

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

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

Type Parameters

T

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

Parameters

span
Span<T>

The source slice, of type T.

Returns

A Span<T> of bytes.

Exceptions

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

Applies to