Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 2
    Sure, but reflection isn't nearly as bad as people make it out to be. Commented Nov 25, 2009 at 20:00
  • Not saying it's bad -- I use it all the time. It is often used needlessly, though. :) Commented Nov 25, 2009 at 20:13
  • 46
    This solution moves the description away from the enum itself, creating at least two big problems. First, if someone adds a new enum constant , they will need to know to go to this other place to add an entry there as well. Attributes are a clear sign to a maintainer of what they need to do. My second problem with it is that it's just a lot more code. Attributes are compact. Commented Jan 29, 2010 at 17:13
  • 1
    @scott but it does let you specify your own order, and exclude values you don't want to display which is nearly always what I actually want Commented May 14, 2013 at 20:38
  • @Simon_Weaver be careful, the documentation says that «The order in which the items are returned (from the dictionary) is undefined.». Commented Nov 25, 2022 at 17:56