title: How can I declare and populate a class at the same time
body: <p>I have code like this:</p>
  
  <pre><code>public class test {
      public string aa { get; set; }
      public string bb { get; set; }
      public string cc { get; set; }
  }
  
  var a = new test {
      aa = "a",
      bb = "b"
  }
  
  var d = a;
  d.cc = "c";
  </code></pre>
  
  <p>Is there any way for me to create class d and at the same time populate it. So for example the last two lines could be combined into one? Note that I want to avoid doing this with a constructor as sometime it will be different fields other than cc which I will populate. </p>
  
  <p>please note my edit </p>
  
  <pre><code>var d = a;
  </code></pre>