title: Extending LINQ to accept nullable enumerables
body: <p>While working with Linq extensions it's normal to see code like this:</p>
  
  <pre><code>IEnumerable&lt;int&gt; enumerable = GetEnumerable();
  int sum = 0;
  if (enumerable != null)
  {
      sum = enumerable.Sum();
  }
  </code></pre>
  
  <p>In order to enhance the code quality, I wrote the following extension method that checks for nullable enumerables and breaks the linq execution.</p>
  
  <pre><code>public static IEnumerable&lt;T&gt; IgnoreIfEmpty&lt;T&gt;(this IEnumerable&lt;T&gt; enumerable)
  {
      if (enumerable == null) yield break;
      foreach (var item in enumerable)
      {
          yield return item;
      }
  }
  </code></pre>
  
  <p>So, I can refactor the code to be like this:</p>
  
  <pre><code>var sum = GetEnumerable().IgnoreIfEmpty().Sum();
  </code></pre>
  
  <hr>
  
  <p>My questions now: </p>
  
  <ol>
  <li>What penalties are associated with my extension method at runtime?</li>
  <li>Is it's a good practice to extend linq that way?</li>
  </ol>
  
  <p><strong>Update:</strong>
  My target framework is: 3.5</p>