title: Convert or map a list of class to another list of class by using Lambda or LINQ?
body: <p>The question and answer of <a href="https://stackoverflow.com/questions/1176038/convert-or-map-a-class-instance-to-a-list-of-another-one-by-using-lambda-or-linq">converting a class to another list</a> of class is cool. How about to convert a list of MyData to another list of MyData2? For example:</p>
  
  <pre><code>List&lt;MyData&gt; list1 = new List&lt;MyData&gt;();
  // somewhere list1 is populated
  List&lt;MyData2&gt; list2;
  // Now I need list2 from list1. How to use similar LINQ or Lambda to get
  list2 = ... ?
  </code></pre>
  
  <p>Here I tried this but I cannot figure out the complete codes:</p>
  
  <pre><code>list2 = (from x in list1 where list1.PropertyList == null
      select new MyData2( null, x.PropertyB, x.PropertyC).
      Union (
        from y in list1 where list.PropertyList != null
        select new MyData2( /* ? how to loop each item in ProperyList */
                y.PropertyB, y.PropertyC)
      ).ToList();
  </code></pre>
  
  <p>where MyData2 has a CTOR like (string, string, string).</p>