共用方式為


TensorPrimitives.ConvertTruncating<TFrom,TTo> 方法

定義

source 複製到 destination,將每個 TFrom 值轉換成 TTo 值。

public:
generic <typename TFrom, typename TTo>
 where TFrom : System::Numerics::INumberBase<TFrom> where TTo : System::Numerics::INumberBase<TTo> static void ConvertTruncating(ReadOnlySpan<TFrom> source, Span<TTo> destination);
public static void ConvertTruncating<TFrom,TTo> (ReadOnlySpan<TFrom> source, Span<TTo> destination) where TFrom : System.Numerics.INumberBase<TFrom> where TTo : System.Numerics.INumberBase<TTo>;
static member ConvertTruncating : 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 ConvertTruncating(Of TFrom As INumberBase(Of TFrom), TTo As INumberBase(Of TFrom)) (source As ReadOnlySpan(Of TFrom), destination As Span(Of TTo))

類型參數

TFrom
TTo

參數

source
ReadOnlySpan<TFrom>

要從中複製值的來源範圍。

destination
Span<TTo>

應該寫入已轉換值的目的地範圍。

例外狀況

目的地太短。

備註

這個方法會有效地計算 destination[i] = TTo.CreateTruncating(source[i])

適用於