Linq method syntax counterpart for Linq query syntax

59 Views Asked by At

I have a collection of orders.
Each order has a subcollection of OrderItems. Now I have a Linq query syntax that works:

var ordersProjection = from order in orders
                   from oi in order.OrderItems
                   where oi.Quantity > 1
                   select new { order.OrderID, oi.ProductName, oi.Quantity };

This is quite simple and works just fine. I would like to know the method syntax for this query. I tried hard but don't seem to get it.
I tried with SelectMany but then I loose the condition >1.
Of what I understand every query syntax is translated into method syntax under the hood. So this should be possible.
Thank you.

0

There are 0 best solutions below