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

推荐订阅源

Vercel News
Vercel News
SecWiki News
SecWiki News
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 司徒正美
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
Y
Y Combinator Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
MyScale Blog
MyScale Blog
K
Kaspersky official blog
T
The Exploit Database - CXSecurity.com
腾讯CDC
Scott Helme
Scott Helme
I
InfoQ
Cyberwarzone
Cyberwarzone
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Security Latest
Security Latest
The Register - Security
The Register - Security
Project Zero
Project Zero
F
Fortinet All Blogs
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
C
Cisco Blogs
L
LINUX DO - 热门话题
P
Privacy International News Feed
IT之家
IT之家
U
Unit 42
P
Privacy & Cybersecurity Law Blog
H
Help Net Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Palo Alto Networks Blog
F
Full Disclosure
宝玉的分享
宝玉的分享
Simon Willison's Weblog
Simon Willison's Weblog
L
Lohrmann on Cybersecurity
Google DeepMind News
Google DeepMind News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
H
Hacker News: Front Page
Know Your Adversary
Know Your Adversary
PCI Perspectives
PCI Perspectives
Hugging Face - Blog
Hugging Face - Blog
AWS News Blog
AWS News Blog
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Recent Announcements
Recent Announcements
Forbes - Security
Forbes - Security
Cisco Talos Blog
Cisco Talos Blog

博客园 - Andrew Yin

数据访问层组件设计以及选型意识流 第四次扩展的讨论 数据访问层组件设计以及选型意识流 第三次封装(极致、极简而不简单) 数据访问层组件设计以及选型意识流 第二次封装以及各种牢骚 数据访问层组件设计以及选型意识流 第一次封装 数据访问层组件设计以及选型意识流 开篇 UTF-8, Unicode, GB2312三种编码方式解析, 深入研究汉字编码 C++中的模板实例:链表模板 一步一步学Ruby系列(二):Ruby中的函数 一步一步学Ruby系列(一):Ruby基础知识 .NET下的AOP: PostSharp 原理分析 AST,DLR,Expression Tree-----------推荐一位牛人的博客! C# 交互式SHELL C#中的 eval System.Web.Routing命名空间代码解析(四) Route解析中用到的实体类,一些以"Segment”为名的类 System.Web.Routing命名空间代码解析(三) RouteCollection类 System.Web.Routing命名空间代码解析(二) Routing类(上) System.Web.Routing命名空间代码解析(一) RouteBase类,RouteData类,RouteValueDictionary类 ASP.NET MVC中的各种上下文对象 有关string和Cookie的几个有用的扩展方法 反射加异步,根据枚举值来异步执行方法
操作Enum的一些实用方法
Andrew Yin · 2008-12-04 · via 博客园 - Andrew Yin

操作Enum的一些实用方法:

        public static T GetEnumItem<T>(string name)
        
{
            Type type 
= typeof(T);
            
if (Enum.IsDefined(type, name))
                
return (T)Enum.Parse(type, name, true);
            
if (Enum.IsDefined(type, "OTHERS"))
                
return (T)Enum.Parse(type, "OTHERS"true);
            
throw new ArgumentException();
        }


        
public static string GetEnumName<T>(T value)
        
{
            Type type 
= typeof(T);
            
return Enum.GetName(type, value);
        }