Editar

Compartilhar via


SpanExtensions.Cast<TFrom,TTo>(Span<TFrom>) Method

Definition

Casts a Span<T> of one primitive type TFrom to another primitive type TTo.

public static Span<TTo> Cast<TFrom,TTo> (this Span<TFrom> span) where TFrom : struct where TTo : struct;
static member Cast : Span<'From (requires 'From : struct)> -> Span<'o (requires 'o : struct)> (requires 'From : struct and 'o : struct)
<Extension()>
Public Function Cast(Of TFrom As Structure, TTo As Structure) (span As Span(Of TFrom)) As Span(Of TTo)

Type Parameters

TFrom

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

TTo

The type of items in the destination Span<T>.

Parameters

span
Span<TFrom>

The source slice, of type TFrom.

Returns

Span<TTo>

A Span<T> of type TTo

Remarks

Supported only for platforms that support misaligned memory access or when the memory block is aligned by other means.

Applies to