Fields

ZeroTolerance

#
public const double ZeroTolerance = 1E-16

Methods

CustomError

#
public static ConversionException CustomError(Type typeA, Type typeB, string message, string nameA = null, string nameB = null)
Create the custom formatted conversion exception.
typeA (Type)Source data type for conversion.
typeB (Type)Target data type of conversion.
message (string)Custom error text with {0} for nameA and {1} for nameB.
nameA (string = null)Optional custom type name.
nameB (string = null)Optional custom type name.

InfiniteConversion

#
public static ConversionException InfiniteConversion(Type typeA, Type typeB, string nameA = null, string nameB = null)
Create the standard 'infinite conversion' exception, usually involving infinite values in the instance of typeA.
typeA (Type)Source data type for conversion.
typeB (Type)Target data type of conversion.
nameA (string = null)Optional custom type name.
nameB (string = null)Optional custom type name.

InvalidConversion

#
public static ConversionException InvalidConversion(Type typeA, Type typeB, string nameA = null, string nameB = null)
Create the standard 'invalid conversion' exception, usually involving NaN or Unset values in the instance of typeA.
typeA (Type)Source data type for conversion.
typeB (Type)Target data type of conversion.
nameA (string = null)Optional custom type name.
nameB (string = null)Optional custom type name.

IsZero

#
protected static bool IsZero(double value)
Test whether a number is considered zero by conversion logic.
value (double)

MissingConversion

#
public static ConversionException MissingConversion(Type typeA, Type typeB, string nameA = null, string nameB = null)
Create the standard 'missing conversion' exception.
typeA (Type)Source data type for conversion.
typeB (Type)Target data type of conversion.
nameA (string = null)Optional custom type name.
nameB (string = null)Optional custom type name.

OverflowConversion

#
public static ConversionException OverflowConversion(Type typeA, Type typeB, string nameA = null, string nameB = null)
Create the standard 'overflow conversion' exception. This ought to be thrown when the source value exceeds the range of the target type.
typeA (Type)Source data type for conversion.
typeB (Type)Target data type of conversion.
nameA (string = null)Optional custom type name.
nameB (string = null)Optional custom type name.