title: Search List of a type for exact variable
body: <p>I want to create a function that would search a list for something and return bool.   </p>
  
  <p>MyList has multiple elements inside. Each has a variable <strong>name</strong> assigned different string. I want to search the list for a particular <strong>name</strong>.
  Example:</p>
  
  <pre><code>public class Type 
  {
      public string name;
  }
  
  List&lt;Type&gt; MyList;
  
  bool FindByName(string str) 
  {
      foreach (Type type in MyList) 
      {
          if (type.name == str) 
              return true;
      }
  }
  </code></pre>
  
  <p>The FindByName function is what I would like to make universal. A function that would take: </p>
  
  <pre><code>List&lt;T&gt;, NameOfVariableToLookIn, U WhatToLookFor
  </code></pre>
  
  <p>And you could just give the function: </p>
  
  <pre><code>List&lt;Type&gt;, name, string str 
  </code></pre>
  
  <p>Worried if this is even possible. I really don't want to write a new function for each new list I create.</p>