I simply want to create enum of operators like this but this gives errors.
Public enum MyOperators {"<", "<=", ">", ">="}
From suggestion on SO , i tried something like this.
Public enum MyOperators {
Less ='<',
LessOrEqual = '<=',
Greater = '>',
GreaterOrEqual = '>='
}
Now it does not like the '=' sign in LessOrEqual and GreaterOrEqual.
You can see how MS approaches it at MS references here for c# operators. I can do that as well but i just wanted to see if there is any better suggestion.
EDIT
If you can make this work without a list and switch statement you would answer my question
enum MyOperators {"<", "<=", ">", ">="}
string s = Console.ReadLine();
MyOperators op;
if (Enum.TryParse(s, true, out op)) {
//user entered operator
}
else {
//not operator
}