foreach enum list code example
Example 1: enum foreach
foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit)))
{
}
Example 2: traversing an enum c#
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>();