var res = from x in q.Rows group x by x.Product into g select new { Product = g.Key, TotalPrice = g.Sum(p => p.Price), TotalQTY = g.Sum(p => p.QTY) }; return q.ToList<object>();
compilerparams.ReferencedAssemblies.Add(typeof(object).Assembly.Location); //mscorlib.dll compilerparams.ReferencedAssemblies.Add(typeof(System.Uri).Assembly.Location); //system.dll compilerparams.ReferencedAssemblies.Add(typeof(System.Linq.Enumerable).Assembly.Location);//system.core.dll
GroupBy
ToList
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)