INumberBase<TSelf>.TryConvertToChecked<TOther> 方法

定義

嘗試將目前型別的實例轉換成另一個型別,針對落在目前類型可表示範圍以外的任何值擲回溢位例外狀況。

protected:
generic <typename TOther>
 where TOther : System::Numerics::INumberBase<TOther> static bool TryConvertToChecked(TSelf value, [Runtime::InteropServices::Out] TOther % result);
protected static abstract bool TryConvertToChecked<TOther> (TSelf value, out TOther result) where TOther : System.Numerics.INumberBase<TOther>;
static member TryConvertToChecked : 'Self * 'Other -> bool (requires 'Other :> System.Numerics.INumberBase<'Other>)
Protected Shared Function TryConvertToChecked(Of TOther As INumberBase(Of TOther)) (value As TSelf, ByRef result As TOther) As Boolean

類型參數

TOther

應該轉換的目標 value 型別。

參數

value
TSelf

用來建立 實例的值 TOther

result
TOther

當這個方法傳回時,包含從 value轉換的 TOther 實例。

傳回

false 如果 TOther 不支援,則為 ,否則為 true

例外狀況

value 無法以 TOther表示。

適用於