I'm new to C# programming. Can someone please explain me with an example on how to enumerate an enum in C#?
Assume you have an enum as follows.
public enum Car { Sports, Sedan, Hatchback, Classic }
You can do the following.
foreach (Car car in (Car[]) Enum.GetValues(typeof(Car))) { }
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Assume you have an enum as follows.
You can do the following.