title: How to set value if nullable int is null
body: <p>I have nullable int in the the model, Is that possible to set the value to some value if get null as the input otherwise set the incoming value as it is.</p>
  
  <p>I tried below</p>
  
  <pre><code>public class MyRequest
      {
          private int? _quantity;
  
          public MyRequest()
          {
              Quantity = 1;
          }
  
          public int? Quantity
          {
              get =&gt; _quantity;
              set =&gt; _quantity = _quantity.IsNullOrDefault() ? Quantity : value;
          }
  </code></pre>
  
  <p>It always gives NULL.</p>