title: How to avoid bool property to automaticly be added to element of a list (c#)?
body: <p>I have the following c# code:</p>
  
  <pre><code>   public class Res1
     {
          public string Name1   { get; set; }
          public string Name2   { get; set; }
          public bool   NameDef { get; set; }
     }
     ...
     ...
     List&lt;Res1&gt; list1 = new List&lt;Res1&gt; { };
     list1.Add(new Res1 { Name1 = "testName" });      
  </code></pre>
  
  <p>The result of list1 will be: </p>
  
  <pre><code>[{"Name1":"testName","NameDef":false}]
  </code></pre>
  
  <p>But I only want the list entry to contain Name1, if NameDef not set, as for Name2 (string)</p>
  
  <p>How do I avoid the bool property to automaticly be added to element of the list?</p>