Enum with string values

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?
 
P

Pete Davis

Sounds like what you want is constants, not enums.

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

Pete
 
S

Steve McLellan

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.
 

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


Top