Microsoft.Tools.WindowsInstaller.EncodingConverter.IsNumeric C# (CSharp) Method

IsNumeric() static private method

Returns true if the type is a signed or unsigned short or larger integer.
static private IsNumeric ( Type type ) : bool
type System.Type The to compare.
return bool
        internal static bool IsNumeric(Type type)
        {
            return typeof(short) == type
                || typeof(int) == type
                || typeof(long) == type
                || typeof(ushort) == type
                || typeof(uint) == type
                || typeof(ulong) == type;
        }

Usage Example

Ejemplo n.º 1
0
 public void IsNumeric()
 {
     Assert.IsTrue(EncodingConverter.IsNumeric(typeof(short)));
     Assert.IsTrue(EncodingConverter.IsNumeric(typeof(int)));
     Assert.IsTrue(EncodingConverter.IsNumeric(typeof(long)));
     Assert.IsTrue(EncodingConverter.IsNumeric(typeof(ushort)));
     Assert.IsTrue(EncodingConverter.IsNumeric(typeof(uint)));
     Assert.IsTrue(EncodingConverter.IsNumeric(typeof(ulong)));
     Assert.IsFalse(EncodingConverter.IsNumeric(typeof(byte)));
     Assert.IsFalse(EncodingConverter.IsNumeric(typeof(float)));
     Assert.IsFalse(EncodingConverter.IsNumeric(typeof(double)));
 }