W3bbo said:
spivonious said:
*snip*

String enumerations are good for things like LookupPrivilegeValue which expects a string privilege name from a known set. I use a static class filled with const string members right now.

I'm not sure I fully follow your example. Why would LookupPrivilegeValue expect a string privilege name instead of an enumeration value? Not to mention there's ways to convert a string to/from an enumeration value, so there should be a way to do what you want there without a "string enumeration".

 

As for the original idea: that's not a language change. Note that the code didn't change in any way. That's a compiler change. Compilers are free to report any diagnostics they want to, generally.  I assume the C# standard provides the same leeway that the C++ standard does (you can produce any warnings you want to for what ever you want, but only the errors specified by the standard). That said, it's not a good idea to produce such diagnostics by the compiler. This adds significant compilation overhead, which is detrimental to the development process. This is the sort of thing you want to see in static analysis tools instead. Microsoft provides such a tool in FXCop or Code Analysis within VisualStudio. I don't believe there's a rule for either of these, but the rules can be added.