c# foreach enum

[ad_1]

loop through an enum c#
public enum Days {
  Monday,
  Tuesday,
  Wednesday
}

foreach(Days day in Enum.GetValues(typeof(Days))) {

}
c# foreach enum
enum Foos {
  Foo,
  Bar,
}

foreach(Foos val in Enum.GetValues(typeof(Foos))) {
  //Do whatever with the value :D
}
enum foreach
foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit)))
{
}
c# foreach enum
foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit)))
{
}

[ad_2]

Please follow and like us:
Content Protection by DMCA.com