title: Get data from a list in C#
body: <p>I've created a list of a class. Here you can see the code:</p>
  
  <pre><code>public class People{
          public string name;
          public int age;     
      }   
  
  public List&lt;People&gt; peopleInfo = new List&lt;People&gt;();
  </code></pre>
  
  <p>My problem is that I have for example a name and now I want to know the age. How do I get this data?
  I can get a name or the age on a specific position by this:</p>
  
  <pre><code>int pos = peopleInfo[0].name;
  </code></pre>
  
  <p>But how I can do it the inverted way and get the position of name? When I have this it easy to get the age.</p>