title: FirstOrDefault() result of a struct collection?
body: <p>So I've got a collection of <code>struct</code>s (it's actually a WCF datacontract but I'm presuming this has no bearing here).</p>
  
  <pre><code>List&lt;OptionalExtra&gt; OptionalExtras;
  </code></pre>
  
  <p><code>OptionalExtra</code> is a <code>struct</code>.</p>
  
  <pre><code>public partial struct OptionalExtra
  </code></pre>
  
  <p>Now I'm running the below statement:</p>
  
  <pre><code>OptionalExtra multiOptExtra = OptionalExtras.Where(w =&gt; w.Code == optExtra.Code).FirstOrDefault();
  if (multiOptExtra != null)
  {
  
  }
  </code></pre>
  
  <p>Now this won't compile:</p>
  
  <blockquote>
    <p>the operator != cannot be applied to opperands of type OptionalExtra
    and <code>'&lt;null&gt;'</code></p>
  </blockquote>
  
  <p>After a little googling I realised it's because <code>OptionalExtra</code> is a <code>struct</code>. Which I believe is not nullable unless defined as a nullable type?</p>
  
  <p>So my question is, if my <code>where</code> statement returns no results what will be the outcome of the <code>FirstOrDefault</code> call? Will it thrown an exception?</p>
  
  <p>Incidently this <em>should</em> never happen but better safe than sorry.</p>