在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
//获取枚举的值
Dictionary<int, string> dicRet = new Dictionary<int, string>(); //获取Enums的值 var resonlist = EnumsHelper.GetEnumValues<MakeSureComplaintReson>(); foreach (var item in resonlist) { dicRet.Add((int)item, item.GetDescription()); } return dicRet;
public enum MakeSureComplaintReson { [Description("a")] reson1 = 1, [Description("b")] reson2 = 2, [Description("c")] reson3 = 3, [Description("其它")] reson9 = 9 }
最终得到的结果: [{1,'a'},{2,'b'},{3,'c'},{9,'其它'}]
|
请发表评论