Is there a right order to join? Example, I have two lists: categories and products, should I first use the from clause with the Categories or Products? And then Join? Example:
var stockQuery = from category in categories
join product in products on category equals product.Category into prodGroup
select new { Key = category.Name, Products = prodGroup };
The code above works normally, but the code below does not, why?
var stockQuery = from product in products
join category in categories on product.Category equals category into prodGroup
select new { Key = category.Name, Products = prodGroup };
Show the error that category
is not in the same context, but I still do not understand why it is not ...