是否枚举 - IsSystemEnum

2017-02-26 15:26:53  访问(1437) 赞(0) 踩(0)


        /// <summary>
        /// typeof(System.Enum)
        /// </summary>
        protected readonly static Type typeSystemEnum = typeof(System.Enum);

        /// <summary>
        /// 是否枚举 - IsSystemEnum
        /// </summary>
        /// <param name="typeValue"></param>
        /// <returns></returns>
        public static  bool IsSystemEnum(Type typeValue)
        {
            while (true)
            {
                if (typeValue == null)
                    return false;

                if (typeValue == typeSystemEnum)
                    return true;

                typeValue = typeValue.BaseType;
            }
        }


标签:是否枚举 - IsSystemEnum 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)