Iterating a List in an Object Initializer
<p>When building an object with the object initializer syntax, is there a way to iterate over a list in one of the assignment statements and assign an output of the iteration to that property?</p>

<p>For example, I have a Person model which I'm converting into a Person view model (mostly because the Person model has lazy-loaded properties and is highly and potentially recursively dynamic, but the view is disconnected over the web and just needs a single Person instance to be serialized).  I'm also using the nVentive Umbrella extensions for handy things like <code>.ForEach()</code> on enumerables.  So to output my list of Person view models from my Person models, I convert them like this:</p>

<pre><code>people.ForEach(p =&gt;
  returnPeople.Add(
    new Person{
      FirstName = p.FirstName,
      ID = p.ID,
      LastName = p.LastName,
      MiddleName = p.MiddleName,
      NamePrefix = p.NamePrefix,
      NameSuffix = p.NameSuffix,
      ParentsID = p.Parents == null ? 0 : p.Parents.ID,
      PartnershipIDs = new List&lt;int&gt;(),
      Sex = p.Sex.ToString()
    }
  )
);
</code></pre>

<p>I'm iterating over the collection of Person models (<code>people</code>) and populating the collection of Person view models (<code>returnPeople</code>).  Everything works fine, but I also want to populate that <code>PartnershipIDs</code> property in the same statement.  Functionality such as:</p>

<pre><code>//....
PartnershipIDs = p.Partnerships.ForEach(par =&gt; yield return par.ID)
//....
</code></pre>

<p>That, however, doesn't work.  The compiler doesn't like the syntax.  But is there a way to accomplish that functionality in this setup?  Or do I have to initialize the Person view model with all but one field first, and then on the next line populate the remaining field?</p>
