title: Making property [NonSerialized] for a value
body: <p>I am trying to figure out how can i make a property [NonSerialized] for a value</p>
  <p>Check this out :</p>
  <pre class="lang-cs prettyprint-override"><code>using System;
  using System.Text.Json;
   
  class Test
  {
      public static bool GoingToBeSerialized = false;
   
   
      public int PaymentForTheDay { get; set; }
      public int NumberOfDays { get; set; }
   
      // i want to disable it if GoingToBeSerialized is true
      [System.Text.Json.Serialization.JsonIgnore] 
      public int TotalPayment;
   
      public  bool ShouldSerializeTotalPayment() =&gt; GoingToBeSerialized;
  }
  </code></pre>
  <p>Thanks.</p>