Either rename the Enum strings as per the display name (not a good idea), or
use a Description attribute for each element, and use reflection to obtain
the description.

Of course neither of those methods is locale independent...

Merak

> -----Original Message-----
> From: Moderated discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Clark, Michael (OFM)
> Sent: 23 June 2003 19:56
> To: [EMAIL PROTECTED]
> Subject: [ADVANCED-DOTNET] ToString Implementation in an Enum
>
>
> There's gotta be a way, but I can't find it...
>
> Suppose you have an enum, such as:
>
> public enum MonetaryUnit
> {
>         USDollar,
>         AUDollar,
>         CDNDollar
> }
>
> And you would like the expression
> MonetaryUnit.USDollar.ToString() to return something like
> "American", or AUDollar to return "Australian", etc.
>
> How would you go about implementing this?
>

Reply via email to