This question already has an answer here:
- Parse string to enum type 8 answers
So I have a list of strings read from an XML file and was wondering if I can create a list of enums from the strings.
For example and clarity on the question:
String list in an array already read in from XML file:
"aString"
"bString"
"cString"
Is there a way to convert those strings into:
enum eAnEnumType
{
aString = 0,
bString,
cString
}
This is so I am able to use them as named flags read in from an XML. I had done some research around this subject and reflection seems to come up alot, but I have not used c# in a while, and never used reflection...
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire