title: How to: Use async methods with LINQ custom extension method
body: <p>I have a LINQ custom extension method:</p>
  
  <pre><code>public static IEnumerable&lt;T&gt; DistinctBy&lt;T, TKey&gt;(this IEnumerable&lt;T&gt; items, Func&lt;T, TKey&gt; property)
  {
      return items.GroupBy(property).Select(x =&gt; x.First());
  }
  </code></pre>
  
  <p>And I am using it like this:</p>
  
  <pre><code>var spc = context.pcs.DistinctBy(w =&gt; w.province).Select(w =&gt; new
              {
                  abc = w
              }).ToList();
  </code></pre>
  
  <p>But the problem is I don't want ToList() I want something like this</p>
  
  <pre><code>var spc = await context.pcs.DistinctBy(w =&gt; w.province).Select(w =&gt; new
               {
                   abc = w
               }).ToListAsync();
  </code></pre>
  
  <p>With Async. But async is not found. How can I make my custom method distinctBy as such so I can also use it asynchronously?</p>