title: C# initialize list property
body: <p>Am having below classes...how do i initialise with some values<br>
          My question is, how do i initialise above RootObject with some values in Main
          For example </p>
  
  <pre><code>    Rootobject robj = new Rootobject();
      robj.inchistor.Add()     
  
  
  
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
  
      namespace JsonSample3
      {
  
          public class Customerinfo
          {
              public string customername { get; set; }
              public string address { get; set; }
              public string postcode { get; set; }
          }
  
          public class Inchistory
          {
  
              public Customerinfo customerinfo { get; set; }
              public string r { get; set; }
              public string reference { get; set; }
              public string region { get; set; }
  
          }
  
          public class RootObject
          {
              public List&lt;Inchistory&gt; inchistory { get; set; }
          }
  
  
      }
  
      class Program
      {
              static void Main(string[] args)
              {
                 RootObject robj = new RootObject{ r = "", }
  
              }
      }
  
  
  
     Am having above classes namely CustomerInfo, Inchistory and Rootobject
  </code></pre>