-
enum question
I am parsing a XML file. I have enum:ed some things like this:
Code:
enum NeighbourhoodDogs {Felix, Fido, Boo}
In the XML file I later get records like this:
Code:
<Dog Name="Boo" Weight="54.30" />
Is there a way to use the enum here to put Boos weight in an array somehow, kind of like this:
Code:
dogweights[Boo] = w;
// w is an extracted value from the XML file
How do I do the mapping from string to enum or do I need to use a hashmap here?
-
Code:
string X = "Fido";
NeighbourhoodDogs Y = System.Enum.Parse(typeof(NeighbourhoodDogs), X, true);
-