ReadOnlySpanExtensions.Cast<TFrom,TTo> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
ReadOnlySpan<TTo>
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.