Last active
April 24, 2016 15:34
-
-
Save ayende/a90467427c9fa44187385cc8b93ac65a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// map | |
from order in docs.Orders | |
from line in order.Lines | |
select new { | |
Product = line.Product, | |
Total = ((line.Quantity * line.PricePerUnit) * (1 - line.Discount)) | |
} | |
// reduce | |
from result in results | |
group result by result.Product into g | |
select new { | |
Product = g.Key, | |
Total = g.Sum(x => x.Total) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment