c# enum items code example
Example 1: enum foreach
foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit)))
{
}
Example 2: foreach enum
foreach (MyEnum enumValue in (MyEnum[]) Enum.GetValues(typeof(MyEnum)))
{
}
foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit)))
{
}
foreach (MyEnum enumValue in (MyEnum[]) Enum.GetValues(typeof(MyEnum)))
{
}