Enums

G

Guest

Is there a method which will return the "text" value of an enum? Say I have
and enum which looks like the following....
public enum DBSource
{
Speed_DB=0,
Clarify_DB=1,
PSI_DB=2,
RNASand_DB=3,
PRGOPS_DB=4,
PRGAdmin_DB=5,
MKIS_DB=6,
DataBarn_DB=7
}

In this particular situation, I have a text value of "MKIS" and I need to
know if that value is represented by one of the "enums" and then if it is, I
need to pass the Enum as a parameter of a method... something like
DBSource.MKIS. Is there a way for me to do this?

Thanks in advance for your assistance!
 
G

Guest

Hey Scott, I enjoyed the article, but I am having difficulty in getting the
following instruction to work....

string[] names = System.Enum.Parse(GetType(Team.Common.RunMode.DBSource));

I get a compile error of "Team.Common.RunMode.DBSource' denotes a 'class'
where a 'variable' was expected).

I am attempting to reference the Enum called "DBSource" which is in a static
Class of Team.Common.RunMode. It looks equivalent to the instruction which I
found in the example you pointed me to. What am I doing wrong?

Thanks in advance for your assistance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Fixing "typos" in enums... 18
Trouble calling a function with enum parameter 3
enums and signed/unsigned 4
Enums: Properties vs. Methods 33
Serialising Enums 11
Minimum Total Difficulty 0
Enums 17
masks and enums 21

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top