예제 #1
0
 static void Example7()
 {
     List <MonthlySales> result = MonthlySales.GetMonthlySales()
                                  .SelectMany(x => x.Sales, (MonthlySalesObj, SalesObj) => new
     {
         MonthlySalesObj.Month,
         SalesObj
     }
                                              ).GroupBy(x => new { x.Month, ProductName = x.SalesObj.Key })
                                  .Select(x => new MonthlySales
     {
         Month = x.Key.Month,
         Sales = new Dictionary <string, double> {
             { x.Key.ProductName, x.Sum(z => z.SalesObj.Value) }
         }
     }).ToList();
 }
예제 #2
0
 static void Example8()
 {
     var result = MonthlySales.GetMonthlySales().SelectMany((x, i) => x.Sales.Select(z => z.Value + i));
 }