Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Loop through elements in an enum
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01089721
Message ID:
01089743
Views:
14
This message has been marked as the solution to the initial question of the thread.
Einar,

You can use the Enum class to do this. The following is the example from MSDN:-
using System;

public class GetNamesTest {
    enum Colors { Red, Green, Blue, Yellow };
    enum Styles { Plaid, Striped, Tartan, Corduroy };

    public static void Main() {

        Console.WriteLine("The values of the Colors Enum are:");
        foreach(string s in Enum.GetNames(typeof(Colors)))
            Console.WriteLine(s);

        Console.WriteLine();

        Console.WriteLine("The values of the Styles Enum are:");
        foreach(string s in Enum.GetNames(typeof(Styles)))
            Console.WriteLine(s);
    }
}
Regards
Neil
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform