Advertisement
Guest User

Untitled

a guest
Sep 15th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. IEnumerable<VMFoodFoodMeal> _fmt = (from e in db.FoodProgramMealFood
  2. join j in db.Foods on e.FoodId equals j.Id
  3. select new
  4. {
  5. Id = e.Id,
  6. Name = j.Name,
  7. });
  8.  
  9. public void Linq103()
  10. {
  11. string[] categories = new string[]{
  12. "Beverages",
  13. "Condiments",
  14. "Vegetables",
  15. "Dairy Products",
  16. "Seafood" };
  17.  
  18. List<Product> products = GetProductList();
  19.  
  20. var q =
  21. from c in categories
  22. join p in products on c equals p.Category into ps
  23. select new { Category = c, Products = ps };
  24.  
  25. foreach (var v in q)
  26. {
  27. Console.WriteLine(v.Category + ":");
  28. foreach (var p in v.Products)
  29. {
  30. Console.WriteLine(" " + p.ProductName);
  31. }
  32. }
  33. }
  34.  
  35. IEnumerable<VMFoodFoodMeal> _fmt = (from e in db.FoodProgramMealFood
  36. join j in db.Foods on e.FoodId equals j.Id
  37. select new VMFoodFoodMeal()
  38. {
  39. Id = e.Id,
  40. Name = j.Name,
  41. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement