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

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - StephenJu

EntLib--Unity Application Block 1.x DevExpress杂项 .Net异步机制 简单的异步调用 按s1_Name+uuid为一组拆分DS 分割dataset:待改进... 序列化 DataGridViewComboBoxColumn的使用 datagridview数据验证 通过关键字查找到dgv相关记录后定位 禁止一个程序启动多个实例 将文本文件的内容写进某个表中 获取Assembly的运行路径 获取ArrayList中的数据(foreach) 关于DataTable里大批量查找的更快速的方法 抽象类 IO DynamicCreateMenu DataTable的简单方法
枚举
StephenJu · 2008-12-26 · via 博客园 - StephenJu

public enum EnumName //tt:枚举名
        {
            [Description(
"t1描述")]//枚举标记t1的描述
            t1=1,//t1:枚举标记 1:枚举值
            [Description("t2描述")]
            t2
=2,
            [Description(
"t3描述")]
            t3
=3
        }
private string GetEnumDescription(Enum enumValue)
        {

            FieldInfo fieldInfo 

= enumValue.GetType().GetField(enumValue.ToString().Trim());
            DescriptionAttribute[] attritutes 
= fieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), falseas DescriptionAttribute[];
            
return attritutes.Length > 0 ? attritutes[0].Description: enumValue.ToString();
        }
//根据枚举标记获得枚举值
            int iEnumValue = (int)Enum.Parse(typeof(EnumName), Convert.ToString(EnumName.t1));
//result:1
            
//根据枚举值得到枚举标记
            EnumName t_type = (EnumName)Enum.Parse(typeof(EnumName), Convert.ToString(iEnumValue), false);
//result:t1
            
//根据枚举标记获得其描述
            string strDescription = GetEnumDescription(t_type);
//result:t1描述