c# 枚举遍历取值以及获取描述信息
编程开发
Enum遍历取值描述信息Description
c# 枚举遍历取值以及获取描述信息
//添加命名空间
using System.ComponentModel;
/测试枚举 语言种类
public enum Language {
[Description("中文")]
Chinese = 0,
[Description("英文")]
English = 1,
[Description("日语")]
Japanese = 2,
[Description("德语")]
German = 3,
[Description("法语")]
French = 4, } `
//获取枚举值的描述信息