Here's how I have done it:

    public static string sMonetaryUnit(MonetaryUnit mu)
    {
      return Enum.Format(typeof(MonetaryUnit), mu, "G");
    }

hth

Helen

> -----Original Message-----
> From: Moderated discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] Behalf Of Clark, Michael
> (OFM)
> Sent: Monday, June 23, 2003 11:56 AM
> 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