Reputation: 9479
In Visual Studio -- well, I am using Visual Studio 11 Beta, so that might be the issue -- I think I am coding enums ok. But while this works:
This does not work:
What is wrong?
Upvotes: 1
Views: 1291
Reputation: 2239
C# is a strong typed language. You are missing the enum name before the enum value. This should work:
return TriangleType.error;
and so on...
Upvotes: 4
Reputation: 1646
If you wanted to do as in your first example and return an int you could cast the value and still use the enum "names", as in:
return (int)TriangleType.scalene;
See this other SO question for more information.
Upvotes: 2
Reputation: 102723
Nothing to do with the VS11 beta. You just have to prefix with the enum name:
return TriangleType.error;
Upvotes: 11