title: Can I initialize an object in one statement using lambda for each syntax?
body: <p>If I have these two classes:</p>
  
  <pre><code>public class StudyClass
  {
      public string className { get; set; }
      public List&lt;Student&gt; students { get; set; }
  }
  
  public class Student
  {
      public string studentName { get; set; }
  }
  </code></pre>
  
  <p>Then I can initialize the StudyClass object like that:</p>
  
  <pre><code>var classObject = GetClassData(); // returns a big object with many properties that I don't need
  
  var studyClass= new StudyClass() {
      className = classObject.className
  }
  
  foreach(var student in classObject.students)
  {
      studyClass.students.add(new Student() {
          studentName = student.Name
      });
  }
  </code></pre>
  
  <p>Is it possible to do it in a more simple way, by doing something like:</p>
  
  <pre><code>var classObject = GetClassData(); // returns a big object with many properties that I don't need
  
  var studyClass= new StudyClass() {
      className = classObject.className,
      students = classObject.students.ForEach...// i am stuck here
  }
  </code></pre>
  
  <p>If it's possible, is there any performance benefit or drawback by doing that ?</p>