title: How can I build a manual version of this?
body: <p>I have a class called <code>Package</code> which holds <code>List&lt;string&gt;</code> and <code>string</code> members, corresponding to a list of dependencies and the name of the package. It overrides <code>Equals()</code>, providing equality based on <code>Package</code> name. I am trying to build a manual version of this line:</p>
  
  <p><code>Uninstallable.RemoveAll(pkg =&gt; Installable.Contains(pkg));</code></p>
  
  <p>where <code>Uninstallable</code> and <code>Installable</code> are <code>List&lt;Package&gt;</code>.</p>
  
  <p>My attempt at a <code>Contains()</code> method:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public static bool MyContains(this List&lt;Package&gt; packages, Package inPkg)
  {
      foreach (Package pkg in packages)
      {
          if (pkg.Equals(inPkg))
          {
              return true;
          }
      }
  
      return false;
  }
  </code></pre>
  
  <p>How can I use this extension method to build the same functionality as the above line, but without the lambda?</p>