What is wrong with this statment below? I get "; expected" when run it in LinqPad with language setting to "C# Statement".
from p in Products where p.UnitPrice > 50 select new {p.ProductID };
Now seem like if I assign it to any var; I don't get any error. But what I find confusing is the statement below works fine and give me results back although I don't assign it to any variable. Any ideas?
from p in Products
let spanishOrders = p.OrderDetails.Where ( o=> o.Order.ShipCountry == "Spain")
where spanishOrders.Any()
group new
{
p.ProductName,
Orders = spanishOrders.Count(),
spanishOrders
}
by p.Category.CategoryName
EDIT: It was my bad actually i couldn't run the second example without assigning it to a variable.