How can you enumerate an enum in C#?
E.g. the following code does not compile:
public enum Suit
{
There are two ways to iterate an Enum:
1. var values = Enum.GetValues(typeof(myenum))
2. var values = Enum.GetNames(typeof(myenum))
The first will give you values in form on an array of **object**s, and the second will give you values in form of an array of **String**s.
Use it in a foreach loop as below:
foreach(var value in values)
{
// Do operations here
}