If you really need an int and a string, one thing you could abuse is Enum.GetName(enumType, enumValue). Just make the names of the enum values the same as the strings you want. Though if i were the person that would need to maintain that code i'd have you shot if you actually use that .
Extendable Enums??? Java-Like
mark oppenheim
You could use attributes to embed this kind of information, for example:
public enum MyEnum
{
[Category("My Category 1")]
Value1 = 1,
[Category("My Category 2")]
Value2 = 2,
}
For more information, see the following MSDN topic: http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpguide/html/cpconExtendingMetadataUsingAttributes.asp
Ryan Garaygay
See http://msmvps.com/blogs/jon.skeet/archive/2006/01/05/classenum.aspx for my ideas about how C# could be improved here.
Jon
ryulite
No you can not do that in C#.
If you really need an int and a string, one thing you could abuse is Enum.GetName(enumType, enumValue). Just make the names of the enum values the same as the strings you want. Though if i were the person that would need to maintain that code i'd have you shot if you actually use that
.