Suppose I have a class
public class Item
{
public int Field1{get;set;}
……
public int FieldN{get;set;}
}
And I want to use group by like this;
Collection.GroupBy(selector“Field1,…,FieldK”)
.Select(x=> new Item
{
Field1 = x.Key.Field1,
…
FieldK= x.Key.FieldK,
FiledK+1= x.Sum(x.FieldK+1),
….
FiledN= x.Sum(x.FieldN)
};
How can I do this using Expresions Tree