I prefer using something like a NameValueList. You have the flexibility of being able to show the descriptions associated with the values (enums you can't have spaces/etc). Also, you can have static properties on your NameValueList to represent any "magic numbers" you'd like to represent. (Such as InvoiceStatus.Paid).
Also, I don't know if it applies to you but if you have the ability for users to define their own status codes (over time) an enumeration wouldn't work well.
Good luck,
Chris
Thanks for the quickly response, now I have two Questions:
1) Adding the Static properties means that If I have to add a value to the list I have to added the property too, I use to have this discutions with my fellow classmate and we never have a better idea, is any?
2) Add the property to the NVList or create a new class?
Or potentially use the best of both worlds
This is nice if these two things aren't important:
1) client defined codes on top of enumerated "magic number" system codes
2) more than one word or description separate (culture variants or spaces in the description, etc) from that of the enum's name. Such as Dark Red instead of DarkRed. (Of course, one could use certain rules to add proper spaces to the enum names).
You probably shouldn’t use an enum if you need
translation. You’d be better off making this list drive off a database
table in that case.
Rocky
From: lprada
[mailto:cslanet@lhotka.net]
Sent: Wednesday, July 25, 2007 9:55 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Enums or NameValueList
I like the Rocky solution but I need translation of text, so
what can I do, is there a way to ue reflexion to search into
Properties.Resources?
Copyright (c) Marimer LLC