enum get all values c# code example
Example 1: loop through an enum c#
public enum Days {
Monday,
Tuesday,
Wednesday
}
foreach(Days day in Enum.GetValues(typeof(Days))) {
}
Example 2: c# iterate enum
var values = Enum.GetValues(typeof(Foos));
Example 3: enum get all values C#
//typed
var values = Enum.GetValues(typeof(Foos)).Cast<Foos>()