惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
P
Palo Alto Networks Blog
腾讯CDC
I
Intezer
A
Arctic Wolf
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
Simon Willison's Weblog
Simon Willison's Weblog
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
Cloudbric
Cloudbric
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
博客园 - 司徒正美
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cyberwarzone
Cyberwarzone
T
Threat Research - Cisco Blogs
T
Troy Hunt's Blog
美团技术团队
Application and Cybersecurity Blog
Application and Cybersecurity Blog
IT之家
IT之家
小众软件
小众软件
T
The Exploit Database - CXSecurity.com
Latest news
Latest news
N
News and Events Feed by Topic
S
Schneier on Security
量子位
罗磊的独立博客
V2EX - 技术
V2EX - 技术
雷峰网
雷峰网
Security Latest
Security Latest
L
LINUX DO - 热门话题
J
Java Code Geeks
博客园 - 【当耐特】
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog
L
Lohrmann on Cybersecurity

博客园 - Waver

Tabbing problems in Firefox in Mac OS X [转] Data Flow Diagrams Tutorial [转] HTML Ampersand Character Codes 也谈完美跨域,JavaScript [转] 浏览器类型检测. (JavaScript) 【转】 Route命令使用详解[转] 使用塑料水瓶要当心 Design Material Websites Summarization. - Waver How to cut through the complexity to find a solution. How to install flash player on Google Chrome browser? ADODB.Stream 对象的属性与方法 VB/VBScript读取和保存UTF-8文件方案 VB6: How To Convert UTF-8 Byte Arrays into Unicode Strings (and vice versa) Perl和OLE Automation Perl Unicode全攻略 ASP+COM 组件开发 SQL高级语法 无法去掉“关闭高级语言服务”解决方案! GCT 英语单词全部核心词汇A-Z GCT 工硕英语词汇语法
Extension Method for ENUM.
Waver · 2009-08-25 · via 博客园 - Waver

        public static string GetStringValue(this Enum value)
        {
            Type type = value.GetType();
            FieldInfo fieldInfo = type.GetField(value.ToString());

            StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes(typeof(StringValueAttribute), false) as StringValueAttribute[];

            return attribs.Length > 0 ? attribs[0].StringValue : null;
        }

      class StringValueAttribute : Attribute
    {
        private string stringvalue = string.Empty;

        public string StringValue
        {
            get { return stringvalue; }
            set { stringvalue = value; }
        }

        public StringValueAttribute(string value)
        {
            stringvalue = value;
        }
    }