Enum with string values

  • Thread starter Thread starter VB
  • Start date Start date
V

VB

I want to return string values like below

public enum PropType

{
All = "A",
Mature = "M"

}

Is this possible at all? Is there any elegent way to return string
values using enum?
 
Sounds like what you want is constants, not enums.

const char All = 'A'
const char Mature = 'M'
....

Pete
 
I want to return string values like below
public enum PropType

{
All = "A",
Mature = "M"

}

Is this possible at all? Is there any elegent way to return string
values using enum?

You should be able to do it with chars, since they just map to integers:

public enum...
{
All = 'A'
Mature = 'M'
};

Isn't possible with strings.
 
Back
Top