title: How to handle nulls in LINQ when using Min or Max?
body: <p>I have the following Linq query:</p>
  <pre><code>result.Partials.Where(o =&gt; o.IsPositive).Min(o =&gt; o.Result)
  </code></pre>
  <p>I get an exception when <code>result.Partials.Where(o =&gt; o.IsPositive)</code> does not contains elements. Is there an elegant way to handle this other than splitting the operation in two and checking for null? I have a class full of operations like this one.</p>
  <p>EDIT: The question is related with LINQ to Objects.</p>
  <p>This is the Exception I'm getting (translated it says: The sequence is empty):</p>
  <p><img src="https://i.stack.imgur.com/nFjFH.png" alt="enter image description here" /></p>