INumberBase<TSelf>.TryConvertToChecked<TOther> Method

Definition

Tries to convert an instance of the the current type to another type, throwing an overflow exception for any values that fall outside the representable range of the current type.

C#
protected static abstract bool TryConvertToChecked<TOther>(TSelf value, out TOther result) where TOther : System.Numerics.INumberBase<TOther>;

Type Parameters

TOther

The type to which value should be converted.

Parameters

value
TSelf

The value which is used to create the instance of TOther.

result
TOther

When this method returns, contains an instance of TOther converted from value.

Returns

false if TOther is not supported; otherwise, true.

Exceptions

value is not representable by TOther.

Applies to

Product Versions
.NET 7, 8, 9