Editar

Compartilhar via


MemoryExtensions.Cast<TFrom,TTo>(Memory<TFrom>) Method

Definition

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

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

Type Parameters

TFrom

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

TTo

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

Parameters

memory
Memory<TFrom>

The source Memory<T>, of type TFrom.

Returns

Memory<TTo>

A Memory<T> of type TTo

Exceptions

Thrown when the data store of memory is not supported.

Applies to