title: How to combine c# predicates
body: <p>Hi I have two predicates. And I wonder if it is possible to join them together somehow into one?
  First:</p>
  
  <pre><code>Predicate&lt;object&gt; viewFilter = f =&gt;
  {
      ExternalUser u = f as ExternalUser;
      return u.AgentName.ToLower().StartsWith(agentName.ToLower());
  };
  </code></pre>
  
  <p>Second:</p>
  
  <pre><code>Predicate&lt;object&gt; viewFilter = f =&gt;
  {
      ExternalUser u = f as ExternalUser;
      return u.ExternalLogin.ToLower().StartsWith(login.ToLower());
  };
  </code></pre>
  
  <p>And this is how joined predicate should look like.</p>
  
  <pre><code>Predicate&lt;object&gt; viewFilter = f =&gt;
  {
      ExternalUser u = f as ExternalUser;
      return u.ExternalLogin.ToLower().StartsWith(login.ToLower()) &amp;&amp; u.AgentName.ToLower().StartsWith(agentName.ToLower());
  };
  </code></pre>
  
  <p>I need this for WPF data grid filter where grid source is ICollectionView.
  So after I've created my predicate I set it into filter like this:</p>
  
  <pre><code>private void FilterByLogin(ICollectionView view, string login)
  {
      Predicate&lt;object&gt; viewFilter = f =&gt;
      {
          ExternalUser u = f as ExternalUser;
          return u.ExternalLogin.ToLower().StartsWith(login.ToLower());
      };
      view.Filter = viewFilter;
  }
  </code></pre>