title: C# conditional lambda instead of if statements. Value cannot be null error
body: <p>I get this error: System.ArgumentNullException: Value cannot be null. But that is the point right? if <code>.FreeAmount</code> is null it should check in the <code>AmountList</code> for a Selected amount. However it fails doing so. I can't really see what I have done wrong here.</p>
  
  <pre><code>var amount = string.IsNullOrEmpty(formModel.FreeAmount)
    ? formModel.AmountList
        .Where(x =&gt; x.Selected)
        .Select(a =&gt; a.Value)
        .SingleOrDefault()
    : formModel.FreeAmount;
  </code></pre>