是否数字类型 - IsNumberType

2017-02-19 13:44:39  访问(1356) 赞(0) 踩(0)


        /// <summary>
        /// typeof(UInt64)
        /// </summary>
        public readonly static Type typeUInt64 = typeof(UInt64);

        /// <summary>
        /// typeof(UInt32)
        /// </summary>
        public readonly static Type typeUInt32 = typeof(UInt32);


        /// <summary>
        /// typeof(UInt16)
        /// </summary>
        public readonly static Type typeUInt16 = typeof(UInt16);

        /// <summary>
        /// typeof(Int64)
        /// </summary>
        public readonly static Type typeInt64 = typeof(Int64);

        /// <summary>
        /// typeof(Int32)
        /// </summary>
        public readonly static Type typeInt32 = typeof(Int32);


        /// <summary>
        /// typeof(Int16)
        /// </summary>
        public readonly static Type typeInt16 = typeof(Int16);

        /// <summary>
        /// typeof(DateTime)
        /// </summary>
        public readonly static Type typeDateTime = typeof(DateTime);


        /// <summary>
        /// typeof(Double)
        /// </summary>
        public readonly static Type typeDouble = typeof(Double);

        /// <summary>
        /// typeof(DateTime?)
        /// </summary>
        public readonly static Type typeDateTimeNull = typeof(DateTime?);

        /// <summary>
        /// typeof(Boolean)
        /// </summary>
        public readonly static Type typeBoolean = typeof(Boolean);

        /// <summary>
        /// typeof(Decimal) 
        /// </summary>
        public readonly static Type typeDecimal = typeof(Decimal);


        /// <summary>
        /// typeof(Decimal) 
        /// </summary>
        public readonly static Type typeSingle = typeof(Single);


        /// <summary>
        /// typeof(String) 
        /// </summary>
        public readonly static Type typeString = typeof(String);


        /// <summary>
        /// typeof(string) 
        /// </summary>
        public readonly static Type typestring = typeof(string);

        /// <summary>
        /// typeof(long) 
        /// </summary>
        public readonly static Type typelong = typeof(long);

        /// <summary>
        /// typeof(long?) 
        /// </summary>
        public readonly static Type typelongNull = typeof(long?);

        /// <summary>
        /// typeof(int) 
        /// </summary>
        public readonly static Type typeint = typeof(int);

        /// <summary>
        /// typeof(int?) 
        /// </summary>
        public readonly static Type typeintNull = typeof(int?);


        /// <summary>
        /// typeof(float) 
        /// </summary>
        public readonly static Type typefloat = typeof(float);

        /// <summary>
        /// typeof(float?) 
        /// </summary>
        public readonly static Type typefloatNull = typeof(float?);

        /// <summary>
        /// typeof(bool) 
        /// </summary>
        public readonly static Type typebool = typeof(bool);


        /// <summary>
        /// typeof(bool?) 
        /// </summary>
        public readonly static Type typeboolNull = typeof(bool?);

        /// <summary>
        /// 是否数字类型 - IsNumberType
        /// </summary>
        /// <param name="theValue"></param>
        /// <returns></returns>
        public bool IsNumberType(Type theValue)
        {
            if (theValue == typeInt64
                || theValue == typeInt32
                || theValue == typeInt16
                || theValue == typeDecimal
                || theValue == typeDouble
                || theValue == typelong)
                return true;

            return false;
        }


标签:是否数字类型 - IsNumberType 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)