Group by linq for nested objects
<p>I am making a group by linq statement where i convert a single list of data into an list with a nested list. Here is my code so far:</p>

<pre><code>[TestMethod]
public void LinqTestNestedSelect2()
{
    // initialization 
    List&lt;combi&gt; listToLinq = new List&lt;combi&gt;() { 
        new combi{ id = 1, desc = "a", name = "A", count = 1 },
        new combi{ id = 1, desc = "b", name = "A", count = 2 },
        new combi{ id = 2, desc = "c", name = "B", count = 3 },
        new combi{id = 2,  desc = "d", name = "B", count = 4 },
    };

    // linq group by
    var result = (from row in listToLinq
                  group new { des = row.desc, count = row.count } by new { name = row.name, id = row.id } into obj
                  select new A { name = obj.Key.name, id = obj.Key.id, descriptions = (from r in obj select new B() { des = r.des, count = r.count }).ToList() }).ToList();

    // validation of the results
    Assert.AreEqual(2, result.Count);
    Assert.AreEqual(2, result[0].descriptions.Count);
    Assert.AreEqual(2, result[0].descriptions.Count);
    Assert.AreEqual(2, result[1].descriptions.Count);
    Assert.AreEqual(2, result[1].descriptions.Count);
}

public class A
{
    public int id;
    public string name;

    public List&lt;B&gt; descriptions;
}

public class B
{
    public int count;
    public string des;
}

public class combi
{
    public int id;
    public string name;
    public int count;
    public string desc;
}
</code></pre>

<p>This is fine if the objects are small like the example. However I will implement this for objects with a lot more properties. How can I efficiently write this statement so I don't have to write field names twice in my linq statement?</p>

<p>I would like to return the objects in the statement and I want something like:</p>

<pre><code>// not working wishfull thinking code 
var result = (from row in listToLinq
              group new { des = row.desc, count = row.count } by new { name = row.name, id = row.id } into obj
              select new (A){ this = obj.key , descriptions = obj.ToList&lt;B&gt;()}).ToList();
</code></pre>

<p><strong>Background</strong>: I am re writing a web api that retrieves objects with nested objects in a single database call for the sake of db performance. It's basically a big query with a join that retrieves a crap load of data which I need to sort out into objects.<br>
<strong>probably important</strong>: the ID is unique.</p>

<p><strong>EDIT:</strong> 
based on the answers so far I have made a solution which sort of works for me, but is still a bit ugly, and I would want it to be better looking.</p>

<pre><code>{
    // start part
    return (from row in reader.AsEnumerable()
            group row by row.id into grouping
            select CreateA(grouping)).ToList();
}

private static A CreateA(IGrouping&lt;object, listToLinq&gt; grouping)
{
     A retVal = StaticCreateAFunction(grouping.First());
    retVal.descriptions = grouping.Select(item =&gt; StaticCreateBFunction(item)).ToList();
    return ret;
}
</code></pre>

<p>I hope the StaticCreateAFunction is obvious enough for what it does. In this scenario I only have to write out each property once, which is what I really wanted. But I hope there is a more clever or linq-ish way to write this.</p>