How can I get the index integer (in this case 0) from an enum when I have a string to compare against the enum?
Enum:
public enum Animals
{
Dog = 0,
Cat = 1
}
string myAnimal = "Dog";
Obviously the following line won't work but it might help you to understand what I want to achieve:
int animalNumber = (int)Animals.[myAnimal];