title: When should I use .Count() and .Count in the context of an IEnumerable<T>
body: <p>I'm aware that <code>.Count()</code> is an extension method in LINQ, and that fundamentally it uses the <code>.Count</code>, so I'm wondering, when should I use <code>Count()</code> and when should I use <code>.Count</code>? Is <code>.Count()</code> predominately better saved for queryable collections that are yet to be executed, and therefore don't have an enumeration yet? Am I <em>safer</em> simply always using <code>.Count()</code> extension method, or vice versa for the property? Or is this solely conditional depending on the collection?</p>
  
  <p>Any advice, or articles, are greatly appreciated.</p>
  
  <h2>Update 1</h2>
  
  <p>After decompiling the <code>.Count()</code> extension method in LINQ it appears to be using the <code>.Count</code> <strong>property</strong> if the <code>IEnumerable&lt;T&gt;</code> is an <code>ICollection&lt;T&gt;</code> or <code>ICollection</code>, which is what most answers have suggested. The only real overhead now that I can see is the  additional null and type checks, which isn't huge I suppose, but could still make a small amount of difference if performance were of the utmost importance.</p>
  
  <p>Here's the decompiled LINQ <code>.Count()</code> extension method in .NET 4.0.</p>
  
  <pre><code>public static int Count&lt;TSource&gt;(this IEnumerable&lt;TSource&gt; source)
  {
      if (source == null)
      {
          throw Error.ArgumentNull("source");
      }
  
      ICollection&lt;TSource&gt; collection = source as ICollection&lt;TSource&gt;;
      if (collection != null)
      {
          return collection.Count;
      }
  
      ICollection collection2 = source as ICollection;
      if (collection2 != null)
      {
          return collection2.Count;
      }
  
      int num = 0;
      checked
      {
          using (IEnumerator&lt;TSource&gt; enumerator = source.GetEnumerator())
          {
              while (enumerator.MoveNext())
              {
                  num++;
              }
          }
          return num;
      }
  }
  </code></pre>