码迷,mamicode.com
首页 > Web开发 > 详细

Net判断一个对象是否为数值类型 z

时间:2014-10-27 12:34:37      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   sp   div   on   log   

http://www.cnblogs.com/SkyD/p/4053461.html

public static bool IsNumeric(this Type dataType)
    {
        if (dataType == null)
            throw new ArgumentNullException("dataType");

        return (dataType == typeof(int)
                || dataType == typeof(double)
                || dataType == typeof(long)
                || dataType == typeof(short)
                || dataType == typeof(float)
                || dataType == typeof(Int16)
                || dataType == typeof(Int32)
                || dataType == typeof(Int64)
                || dataType == typeof(uint)
                || dataType == typeof(UInt16)
                || dataType == typeof(UInt32)
                || dataType == typeof(UInt64)
                || dataType == typeof(sbyte)
                || dataType == typeof(Single)
//Decimal ); }

 

Net判断一个对象是否为数值类型 z

标签:style   blog   http   io   ar   sp   div   on   log   

原文地址:http://www.cnblogs.com/zeroone/p/4053799.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!