title: Error assigning null to a nullable int - "The value 'null' is not valid for property"
body: <p>I have this property in my view model:</p>
  
  <pre><code>[DisplayName("Region")]
  public int? RegionId { get; set; }
  </code></pre>
  
  <p>I pass my view model to my controller, and it fails at <code>ModelState.IsValid</code> if RegionId is null. If I pass an integer to it, it works fine.</p>
  
  <p>The error message is:</p>
  
  <blockquote>
    <p>The value 'null' is not valid for Region</p>
  </blockquote>
  
  <p>I've also tried calling this before I check <code>ModelState.IsValid</code>, but I get the same error:</p>
  
  <pre><code>if (viewModel.RegionId == null)
      viewModel.RegionId = (int?)null;
  </code></pre>
  
  <p>What's the problem here? Why can't I assign null to something that is nullable?</p>