Edytuj

Udostępnij za pośrednictwem


ReadOnlySpanExtensions.Cast<TFrom,TTo> Method

Definition

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

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

Type Parameters

TFrom

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

TTo

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

Parameters

span
ReadOnlySpan<TFrom>

The source slice, of type TFrom.

Returns

A ReadOnlySpan<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