Friday, December 14, 2007

Iterating through Enum

Every time i need to iterate through enum, i forget how to do it... so, for the last time:

foreach(byte b in Enum.GetValues(typeof(CounterPartyVO.CounterPartyTypes)))
Console.WriteLine("{0} : {1}"
, b
, Enum.GetName(typeof(CounterPartyVO.CounterPartyTypes), b)
);

No comments: