Re: enum ToString();

Girish Jain <[email protected]> Sun, 8 Jul 2007 07:08:40 +0530
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <000001c7c100$b6850480$17e4b1ca@abcea9n5hg9uxi>
Is an enum an object?
An enum is a value type and not a reference type. Therefore, its not an
object. Can be converted to object using boxing.

Is there a way for me to override the ToString() method?
I guess not.

If not, what would be ways for me to provide a description for each
enumerated value?
Enumerated values are themselves descriptions for some integer sets of
values. I believe you need to use set of **const** values for your
purpose.

I might be incorrect. If I am wrong, someone please correct!!

-Girish Jain

-----Original Message-----
From: Discussion forum for developers using Windows Forms to build apps
and controls [mailto:[email protected]] On Behalf Of
R. Rogers
Sent: 27/08/2007 10:05 PM
To: [email protected]
Subject: [DOTNET-WINFORMS] enum ToString();

Hi everyone,

I have the following declarations:
        enum UploadTypes { utRPlus, utRdf, ut3000Extra, utBridge,
utDealing
};
        UploadTypes UserSelectedUploadType;

Later on I have the following:
UploadTypeCell.Value = UserSelectedUploadType.ToString();

Questions:
Is an enum an object?
Is there a way for me to override the ToString() method?
If not, what would be ways for me to provide a description for each
enumerated value?

Richard