Bagikan melalui


TensorPrimitives.ConvertChecked<TFrom,TTo> Metode

Definisi

Menyalin source ke destination, mengonversi setiap nilai TFrom menjadi nilai TTo.

public:
generic <typename TFrom, typename TTo>
 where TFrom : System::Numerics::INumberBase<TFrom> where TTo : System::Numerics::INumberBase<TTo> static void ConvertChecked(ReadOnlySpan<TFrom> source, Span<TTo> destination);
public static void ConvertChecked<TFrom,TTo> (ReadOnlySpan<TFrom> source, Span<TTo> destination) where TFrom : System.Numerics.INumberBase<TFrom> where TTo : System.Numerics.INumberBase<TTo>;
static member ConvertChecked : ReadOnlySpan<'From (requires 'From :> System.Numerics.INumberBase<'From>)> * Span<'o (requires 'o :> System.Numerics.INumberBase<'o>)> -> unit (requires 'From :> System.Numerics.INumberBase<'From> and 'o :> System.Numerics.INumberBase<'o>)
Public Shared Sub ConvertChecked(Of TFrom As INumberBase(Of TFrom), TTo As INumberBase(Of TFrom)) (source As ReadOnlySpan(Of TFrom), destination As Span(Of TTo))

Jenis parameter

TFrom
TTo

Parameter

source
ReadOnlySpan<TFrom>

Rentang sumber untuk menyalin nilai.

destination
Span<TTo>

Rentang tujuan tempat nilai yang dikonversi harus ditulis.

Pengecualian

Tujuan terlalu pendek.

Keterangan

Metode ini secara efektif menghitung destination[i] = TTo.CreateChecked(source[i]).

Berlaku untuk