C# 遍历枚举

代码

        
/// <summary>
        
/// 遍历枚举绑定
        
/// </summary>
        public void BindTreeType()
        {
            
//遍历枚举绑定
            foreach (string str in Enum.GetNames(typeof(ENUM.E_treeType)))
            {
                ddlTreeType.Items.Add(str, Enum.Parse(
typeof(ENUM.E_treeType), str).GetHashCode());
            }
        }
原文地址:https://www.cnblogs.com/jgjgjg23/p/1909825.html