-
Getting friendly names from an Enum when decorated with multiple attribute
It came about in MVC project I was working on that we wanted to output friendly names for a large number of enumerations we were working on directly into a selectable dropdown list. We would have an enum on a ViewModel object and that would be automatically put into a combo box with the selected item shown. Because alot of our model was pre-generated and we were getting these models from XML serialisation we ended up with a bunch of Enums defined like so. Enum TestEnum { [System.Xml.Serialization.XmlEnumAttribute("Tested")] Test, AnotherOne } Ideal. We already had the enums created. So we went about creating a helper method that would work with…