Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I want Polymorphic enums
Message
From
01/03/2006 13:37:22
 
 
To
01/03/2006 13:05:14
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01100503
Message ID:
01100533
Views:
15
Just to help keep your story straight, this is a quote directly from me. It was a 3rd party quote I copied from the newsgroups when someone asked a question similar to yours.

The general consensus was to agree with the quote I referenced.

>This is an issue that has annoyed me for a while, but after reading Bill Caton's message #1098525, I was inspired to weigh in.
>
>I want the possibility to declare abstract or virtual enums.
>
>A simple example would be a class called Purebred with an abstract enum called Breed. I would subclass Cat and Dog classes. For dog, the breed enum would countain AfghanHound, Beagle, Collie, etc. and for cat it would be Abyssinian, Birman, CornishRex, etc. For a specific instance, a property would expose the value of a specific instance.
>
>An even more practical example might be an abstract enum called color, where each subclass would implement it to define the subset of all possible colors that it was allowed to be.
>
>Referring to Perry Forman's quote,
>
>"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)."
>
>Does this apply to what I would like to do?
>
>I could declare an abstract int object which Cat and Dog implemented that tied to some kind of DataTable that I pulled from a DataBase that associated ints with strings, or something equally awkward, but it isn't as clean.
>
>If someone can suggest a way to accomplish the same kind of pattern, I would appreciate it.

(On an infant's shirt): Already smarter than Bush
Previous
Reply
Map
View

Click here to load this message in the networking platform