首页 > Web开发 > 详细

html中select便签根据枚举获得的总结

时间:2016-02-02 16:27:49      阅读:197      评论:0      收藏:0      [点我收藏+]

先po一段在网上找的代码,获取C#枚举中的描述值的:

  /// <summary>
        /// 获取描述信息
        /// </summary>
        /// <param name="en">枚举</param>
        /// <returns></returns>
        public static string GetEnumDes(Enum en) {
                Type type = en.GetType();
                MemberInfo[] memInfo = type.GetMember(en.ToString()); 
                if (memInfo != null && memInfo.Length > 0)
                {
                        object[] attrs = memInfo[0].GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
                        if (attrs != null && attrs.Length > 0)
                        return ((DescriptionAttribute)attrs[0]).Description;
                }           
                return en.ToString(); 
       }

 

html中select便签根据枚举获得的总结

原文:http://www.cnblogs.com/junshijie/p/5177612.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!