C# 遍历枚举类
2020-12-13 14:09
                         标签:style   blog   color   ar   for   sp   div   on   log    framework 4.0 环境下 方法 定义枚举类 判断枚举类中是否存在,若存在则输出 例子:   framework 4.0 以下版本 定义哈希表或者list集合,然后验证集合中是否存在要验证的数值 C#  遍历枚举类 标签:style   blog   color   ar   for   sp   div   on   log    原文地址:http://www.cnblogs.com/running-mydream/p/4058722.htmlDefined.QrCode.QrCodeType type;//枚举类
if (!Enum.TryParse
Liststring> lst=new Liststring>();
foreach (testenum item in Enum.GetValues(typeof(testenum)))
{
     lst.add(item);
}
if(lst.contains("aa"))
{
    Messagebox.Show("包含aa")
}