Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loop through elements in an enum
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01089721
Message ID:
01089743
Vues:
16
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform