Answers for "loop enum"

6

enum foreach

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

loop over enum values

var values = Enum.GetValues(typeof(EnumName));

foreach (var value in values)
{
	Combobox.Items.Add(value.ToString());
}
Posted by: Guest on May-21-2020

Browse Popular Code Answers by Language