Reputation: 1855
I am creating class like this with enum.
public class D
{
enum e { "one","two","three"};
}
It is giving "identifier expected" compilation error. Whats wrong in this. is there any another structure.
Upvotes: 1
Views: 2119
Reputation: 17603
You can't have string enumerations in C#, for an example using attributes have a look at this article at codeproject.
You need to define your enum like
enum e
{
One, Two, Three
}
Upvotes: 3
Reputation: 4459
The answer is in the error message. You need to identify each of the values in the enum e.g.
enum e
{
One = 1,
Two = 2,
Three = 3
}
Upvotes: 2