Skip to content

Instantly share code, notes, and snippets.

@ayende
Last active April 24, 2016 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayende/a90467427c9fa44187385cc8b93ac65a to your computer and use it in GitHub Desktop.
Save ayende/a90467427c9fa44187385cc8b93ac65a to your computer and use it in GitHub Desktop.
// 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