title: C# code won't compile. No implicit conversion between null and int
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/858080/nullable-types-and-the-ternary-operator-why-wont-this-work">Nullable types and the ternary operator: why is `? 10 : null` forbidden?</a></p>
  </blockquote>
  
  <p>Why doesn't this work? Seems like valid code.</p>
  
  <pre><code>  string cert = ddCovCert.SelectedValue;
    int? x = (string.IsNullOrEmpty(cert)) ? null: int.Parse(cert);
    Display(x);
  </code></pre>
  
  <p>How should I code this? The method takes a Nullable. If the drop down has a string selected I need to parse that into an int otherwise I want to pass null to the method.</p>