Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

loop through an enum c#

public enum Days {
  Monday,
  Tuesday,
  Wednesday
}

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

Loop through enum C#

enum Foos {
  Foo,
  Bar,
}

foreach(Foos val in Enum.GetValues(typeof(Foos))) {
  //Do whatever with the value :D
}
Comment

loop through all enum values in C#

var values = Enum.GetValues(typeof(Foos));
foreach(Foos foo in values) {
	// do something, use foo
}

// or
foreach(Foos foo in Enum.GetValues(typeof(Foos))) {
	// do something, use foo
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: get length of a string c# 
Csharp :: get time part from datetime as timestamp in c# 
Csharp :: Xamarin.Forms - How to navigate to a tabbed page child page 
Csharp :: asp net bootstrap 5 navigation bar 
Csharp :: unity 2d joystick controls 
Csharp :: access a local varible in a different function C# 
Csharp :: waitforseconds unity 
Csharp :: how to add a list to observablecollection in c# 
Csharp :: c# run file 
Csharp :: remove carriage returns from string c# 
Csharp :: c# hex to console color 
Csharp :: c# pick a random item from array 
Csharp :: c# palidrone 
Csharp :: C# .net core convert to int round up 
Csharp :: asp.net get query string parameter 
Csharp :: unity check if a animator parameter trigger is activated 
Csharp :: Attribute [livewire] does not exist. 
Csharp :: how to run code without a gameobject unity 
Csharp :: merge sort in c# 
Csharp :: how to set up blender with unity units 
Csharp :: c# get offset from timezone 
Csharp :: c# remove special characters from string 
Csharp :: reverse a string in c# 
Csharp :: onkeypressed unity 
Csharp :: c# if statement one line 
Csharp :: dialog box with form flutter 
Csharp :: how to write int array to console c# 
Csharp :: c# bitmap to byte array 
Csharp :: WPF Confirmation MessageBox 
Csharp :: c# list slice 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =