Geeks With Blogs
Moez Mousavi April 2011 Entries
Enums, the value of consistency
I love enums, they are organising my head, sometime you might need to traverse through all enum members for any reason. Say you would like to dynamically add controls to the form on the base of enum... foreach (MyTypeEnum myType in Enum.GetValues(typeof(MyTyp... { //myType.ToString() } Or say put all enum values in a list box var lst = Enum.GetValues(typeof(MyTyp... .Select(o => new ListItem { Text = o.ToString(), Value = ((int)o).ToString() }); myList.Items.AddRange(lst.T... ......

Posted On Friday, April 22, 2011 6:03 PM

Copyright © MoezMousavi | Powered by: