LINQ group not working
I have this LINQ query:
from p in Products
join c in Categories on p.CategoryID equals c.CategoryID
group p by p.Category into prices
select new {price = prices.Average(p => p.UnitPrice), name = p.Category.CategoryName }
The error I am getting:
The name 'p' does not exist in the current context
Why can't I access p here? What can I do to fix this problem?
+3
source to share