Getting the XmlEnumAttribute value for an Enum field

I recently had to convert an Enum back to its original Xml value so I thought I’d share the little method I wrote with you all incase you wondered how to do it yourself.


Example Enum Class

Example usage

An Enum of TestEnumClass.FirstValue will then return “FirstValue”, while TestEnumClass.ThirdValue will return “The Third one”.

Hope you find that useful.