Ejemplo n.º 1
0
        private static string GetNumericSubtype(IConvertible convValue)
        {
            string subtype = null;

            if (convValue is decimal)
            {
                subtype = "decimal";
            }
            else if (convValue.IsFloatingPoint())
            {
                subtype = "floating-point";
            }
            else if (convValue.IsUnsignedIntegral())
            {
                subtype = "unsigned-integer";
            }
            else if (convValue.IsSignedIntegral())
            {
                subtype = "signed-integer";
            }

            return(subtype);
        }
 /// <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());
 }
        private static string GetNumericSubtype(IConvertible convValue)
        {
            string subtype = null;

            if (convValue is decimal)
            {
                subtype = "decimal";
            }
            else if (convValue.IsFloatingPoint())
            {
                subtype = "floating-point";
            }
            else if (convValue.IsUnsignedIntegral())
            {
                subtype = "unsigned-integer";
            }
            else if (convValue.IsSignedIntegral())
            {
                subtype = "signed-integer";
            }

            return subtype;
        }