/// <summary> /// Determines whether the specified value is one of the simple types defined by C# to /// contain numeric values. /// <para> /// This method is equivalent to /// <code> /// value.IsIntegral() || value.IsFloatingPoint() || (value is decimal) /// </code>. /// </para> /// </summary> /// <param name="value"></param> /// <returns></returns> public static bool IsNumeric(this IConvertible value) { return((value is decimal) || value.IsIntegral() || value.IsFloatingPoint()); }
/// <summary> /// Determines whether the specified value is one of the simple types defined by C# to /// contain integer values but is not a <c>char</c>. /// </summary> /// <para> /// This method is equivalent to /// <code> /// value.IsSignedIntegral() || value.IsUnsignedIntegralAndNotChar() /// </code>. /// </para> /// <param name="value"></param> /// <returns></returns> public static bool IsIntegralAndNotChar(this IConvertible value) { return(!(value is char) && value.IsIntegral()); }