Answers for "each enum property"

4

c# foreach enum

enum Foos {
  Foo,
  Bar,
}

foreach(Foos val in Enum.GetValues(typeof(Foos))) {
  //Do whatever with the value :D
}
Posted by: Guest on October-07-2020
0

foreach enum

foreach (MyEnum enumValue in (MyEnum[]) Enum.GetValues(typeof(MyEnum)))
{
}
Posted by: Guest on November-10-2020

Browse Popular Code Answers by Language