3 ms·
Something like this? https://dotnetfiddle.net/xwYCrt https://dotnetfiddle.net/xwYCrt You can also use the Enum static functions in order to get metadata on an
by koyote 6y ago
Something like this?
https://dotnetfiddle.net/xwYCrt https://dotnetfiddle.net/xwYCrt
You can also use the Enum static functions in order to get metadata on any enum. If you use attributes such as [Display("Pretty Name")] you can use that to retrieve the value from an enum.
- throwaway_pdp09 6y agoThat's an extension method, I was doing that. What's new is you can pass in any enumeration as you've used Enum as the base class. OK, I should have thought of that. Not sure it would have helped but... Now the [Display("Pretty Name")] is what I want! It apparently uses reflection, but for my app that's a very acceptable cost. I can see a few hundred LOC disappearing - thanks so much!