Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Programmatic enums in C#
Message
De
24/02/2006 08:35:53
 
 
À
23/02/2006 15:40:57
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01098525
Message ID:
01098834
Vues:
10
Hi Perry,

Well, as I mentioned to Einar I have other mechanisms but there are some functional aspects of enums I wanted to use in a specific context.

At any rate, everyone is entitled to their opinion, but I disagree with the one cited below. :-) I suspect that if it were possible to manipulate enums programmatically some of those opinions would change.

Bill

>Bill,
>
>I was looking for something on MSDN today and there's a thread in the C# newsgroup similar to this. Here's a reply that all the posters seemed to agree with:
>
>"If you are finding you need to do something like this, the design of your program is clearly all wrong. Enums are there for hard coded groups of items that will never change during runtime. If for example you want people to add groups (e.g. add a username), you should use an alternative datasource (e.g. database, file)."
>
>
>
>
>>Hi Einer,
>>
>>Thanks for the reply. I figured it was such. I have other methods I can use to accomplish the task. :-) I wanted to data drive the enums since their functionality can be useful at times.
>>
>>Bill
>>
>>>>I'm afraid I know the answer to this :-( but after some unsuccessful tinkering, is it possible to programmatically create and populate enums in C# or are they static by design?
>>>>
>>>>Thanks,
>>>>Bill
>>>
>>>I am pretty sure they are static by design. What I am really wondering is why do you want to change them at runtime? Do you want to change the value? If you could try to explain what you want to accomplish I am sure we (i.e UT's members) can come up with other possible solutions.
>>>
>>>Einar
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform