foreach enum code example
Example 1: enum foreach
foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit)))
{
}
Example 2: c# foreach enum
enum Foos {
Foo,
Bar,
}
foreach(Foos val in Enum.GetValues(typeof(Foos))) {}
Example 3: foreach enum
foreach (MyEnum enumValue in (MyEnum[]) Enum.GetValues(typeof(MyEnum)))
{
}