vendredi 3 novembre 2017

XmlEnumAttribute to Enum parse

I have enum class that looks like this:

public enum StupidEnum
    {

        /// <remarks/>
        [System.Xml.Serialization.XmlEnumAttribute("01")]
        Item01,

        /// <remarks/>
        [System.Xml.Serialization.XmlEnumAttribute("01_1")]
        Item01_1,

        /// <remarks/>
        [System.Xml.Serialization.XmlEnumAttribute("01_11")]
        Item01_11,
}

And now I would like to get Item01_11 enum object by only giving 01_11 value. In other words I have value from Xml Enum Attribute and as a result I would need enum object to be returned.





Aucun commentaire:

Enregistrer un commentaire