I have the following piece of code :
private List<KeyValuePair<int, string>> _list = new List<KeyValuePair<int, string>>();
public MyclassConstructor()
{
foreach (Enum value in Enum.GetValues(typeof(FontStyle)))
_list.Add(new KeyValuePair<int, string>((int)value, value.ToString()));
}
I can't figure out how to get the int part of this enum as the key... pretty dumb question I'm sure but I can't get it working.
I was refering to this article up here on stackoverflow but as you can see this doesn't work
So how can I get the int value of the enum?
Edit : When I try to compile I got the following error message "Cannot convert type 'System.Enum' to 'int'"