Table of Contents

Method TryConvertFromChecked

Namespace
Zyl.VectorTraits.Numerics
Assembly
VectorTraits.dll

TryConvertFromChecked<TSelf, TOther>(TOther, out TSelf)

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

public static extern bool TryConvertFromChecked<TSelf, TOther>(TOther value, out TSelf result) where TSelf : INumberBase<TSelf> where TOther : INumberBase<TOther>

Parameters

value TOther

The value that's used to create the instance of TSelf.

result TSelf

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

Returns

bool

false if TOther is not supported; otherwise, true.

Type Parameters

TSelf
TOther

The type of value.

Exceptions

OverflowException

value is not representable by TSelf.