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:
01089756
Vues:
21
Neil,
Just what I needed. Who would thought to look in the Enum class for this <bg>

Thanks,
Einar

>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
Semper ubi sub ubi.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform