Enums

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
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

Enum 4
Enum 1
about enum 3
Enum 3
Compilation error CS0103 6
Generic.List 1
Generic List. Remove duplicate 2
Enum TypeConverter 3

Back
Top