6 ms·
> You can do exactly what java calls enums with classes in C# No you cannot. You lose the single biggest benefit of enumerations - namely compile-time checking
by TheLoneWolfling 11y ago
> You can do exactly what java calls enums with classes in C#
No you cannot. You lose the single biggest benefit of enumerations - namely compile-time checking. (For instance: warning when a switch statement does not cover all cases.)
Try to do this in C#, and you'll see what I mean: http://snipplr.com/view/42422/the-planet-enum-example/ http://snipplr.com/view/42422/the-planet-enum-example/. Either you end up with it being ~3x as verbose (if not more), or you lose the compile-time benefits, or both.