Enum: GetNames and GetValues. Difference?

  • Thread starter Thread starter Armin Bajramovic
  • Start date Start date
A

Armin Bajramovic

Hi,

I have enum:

public enum StatusEnum
{
Active = 'A',
Nonactive = 'N',
Deleted = 'D'
}

The strange thing is that both Enum.GetNames(typeof(StatusEnum)) and
Enum.GetValues(typeof(StatusEnum)) methods return same thing - names. How do
I get enum values ('A', 'N', 'D')?

TIA
Armin
 
Armin,

foreach(int i in Enum.GetValues(typeof(StatusEnum)))
Console.WriteLine(i);

Works just fine.
 
Thx, you're right.



Miha Markic said:
Armin,

foreach(int i in Enum.GetValues(typeof(StatusEnum)))
Console.WriteLine(i);

Works just fine.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

Armin Bajramovic said:
Hi,

I have enum:

public enum StatusEnum
{
Active = 'A',
Nonactive = 'N',
Deleted = 'D'
}

The strange thing is that both Enum.GetNames(typeof(StatusEnum)) and
Enum.GetValues(typeof(StatusEnum)) methods return same thing - names. How
do
I get enum values ('A', 'N', 'D')?

TIA
Armin
 
Back
Top