loop through all the values of an enum ? code example
Example 1: enum foreach
foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit)))
{
}
Example 2: loop over all values in enum
var values = Enum.GetValues(typeof(Foos)).Cast<Foos>();
foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit)))
{
}
var values = Enum.GetValues(typeof(Foos)).Cast<Foos>();