public static bool IsInteger(this Type type)
{
type = GetNonNullableType(type);
if (type.GetTypeInfo().IsEnum)
{
return false;
}
switch (type.GetTypeCode())
{
case TypeCode.Byte:
case TypeCode.SByte:
case TypeCode.Int16:
case TypeCode.Int32:
case TypeCode.Int64:
case TypeCode.UInt16:
case TypeCode.UInt32:
case TypeCode.UInt64:
return true;
default:
return false;
}
}