Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Enum Question
Message
De
12/06/2008 17:27:24
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Divers
Thread ID:
01323491
Message ID:
01323620
Vues:
14
>>Einar,
>>
>>>
>>>You can create them in any class that is accessible from the rest of the application :)
>>>For one project solutions I have sometimes put application wide enums in the class that contains static void Main() (by "default" in Program.cs)
>>>
>>>In bigger solutions I have created a class with "generic" enums.
>>>
>>
>>I don't typically put Enums in a class and hadn't really thought of doing that. What would be the advantage? Do they become only accessable to the class if they are not declared public?
>>Tim
>
>And I had not thought of putting an enum outside of a class.
>If en enum is withing a class and is private it is only accessible from within that class. I use that feature quite a bit.
>
>Now I have to ponder when I out want my enum outside of the class

Too funny. Glad we all keep learning otherwise it would get boring. I have Enums like this I use throughout the application. The value is stored in a setting file as int, but all references are from the enum. I need it to be public in this case. Just an example.
public enum ApplicationMode
{
     None = 0,
     ThumbDrive = 1,
     Wifi = 2,
     Web = 3
}
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform