namespace adas_core.Domain.Utils;
///
/// Provides a collection of static utility methods for performing common numeric operations.
///
public static class NumberUtils
{
///
/// Determines whether the specified object is an instance of any built-in numeric type, including signed and unsigned integral types as well as floating-point and decimal types.
///
/// The object to evaluate.
/// true if is one of the supported numeric types (sbyte, byte, short, ushort, int, uint, long, ulong, float, double, or decimal); otherwise, false.
public static bool IsNumber(this object value)
{
return value is sbyte
|| value is byte
|| value is short
|| value is ushort
|| value is int
|| value is uint
|| value is long
|| value is ulong
|| value is float
|| value is double
|| value is decimal;
}
///
/// Converts the specified object to a double-precision floating-point number using the underlying conversion.
///
/// The object to convert to a .
/// A that represents the converted value.
public static double ToDouble(this object value)
{
return Convert.ToDouble(value);
}
}