title: What's the best LINQ way to filter a sequence around a pivot?
body: <p>I'm playing with QuickSort and LINQ, and want to separate the sequence into item before, equal-to, and after a pivot.</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>    public static Tuple&lt;IEnumerable&lt;T&gt;, IEnumerable&lt;T&gt;, IEnumerable&lt;T&gt;&gt; ComparativeWhere&lt;T&gt;(this IEnumerable&lt;T&gt; source, T t)
          where T : IComparable&lt;T&gt;
      {
          return new Tuple&lt;IEnumerable&lt;T&gt;, IEnumerable&lt;T&gt;, IEnumerable&lt;T&gt;&gt;(
              source.Where(x =&gt; x.CompareTo(t) &lt; 0),
              source.Where(x =&gt; x.CompareTo(t) == 0),
              source.Where(x =&gt; x.CompareTo(t) &gt; 0)
              );
      }
  </code></pre>
  
  <p>What's the best way to do this? Is this the best implementation, or is there a better one? Or should I be using a library function I don't know about?</p>