I have an xml file that I store various different enum names, I now need to be able to read that enum name out of the file and convert it to a list of that values just based on the string form of the enum name. is there any way to do this?I dont have the enum type and that is my problem with this.
Asked
Active
Viewed 33 times
0
-
You also need to know the enum type. Then you can use [Enum.Parse](https://msdn.microsoft.com/en-us/library/essfb559(v=vs.110).aspx) – Sani Huttunen Nov 04 '16 at 08:49
-
1Wanted to post this as an answer before this question got closed: If you are using the `XmlSerializer` to read your xml, simply add some [`XmlEnumAttribute`s](https://msdn.microsoft.com/de-de/library/system.xml.serialization.xmlenumattribute(v=vs.110).aspx) to your enum members. – Manfred Radlwimmer Nov 04 '16 at 08:51
-
Some tips for your next question: Post the code you are using now, where it goes wrong, what you have tried so far, etc. Recommended reading: [mcve] – Manfred Radlwimmer Nov 04 '16 at 08:52