有没有办法通过所有枚举值迭代? [英] Is there a way to iterate through all enum values?
本文介绍了有没有办法通过所有枚举值迭代?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:结果
的 C#中:如何枚举枚举
块引用>
这个问题说,所有。我想用它来添加一个组合框枚举值。
感谢
vIceBerg
解决方案的String [] =名称Enum.GetNames(typeof运算(MyEnum));
然后,只需填充下拉枝条阵列
Possible Duplicate:
C#: How to enumerate an enum?The subject says all. I want to use that to add the values of an enum in a combobox.
Thanks
vIceBerg
解决方案string[] names = Enum.GetNames (typeof(MyEnum));
Then just populate the dropdown withe the array
这篇关于有没有办法通过所有枚举值迭代?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文