Answers for "c# how to iterate on enum values ?"

C#
1

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
}
Posted by: Guest on July-01-2021
1

c# iterate enum

var values = Enum.GetValues(typeof(Foos));
Posted by: Guest on January-09-2021

C# Answers by Framework

Browse Popular Code Answers by Language