Answers for "foreach in enum c#"

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
6

enum foreach

foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit)))
{
}
Posted by: Guest on March-23-2020
1

c# list.foreach

List<string> someList = <some way to init>
someList.ForEach(delegate(string s) {
    <process the string>
});
Posted by: Guest on May-28-2020

Browse Popular Code Answers by Language