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