Guest User

Untitled

a guest
Jan 16th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. //Round 1 Melbourne City -Brisbane Roar 2 - 0
  2. //Round 1 Central Coast-Newcastle Jest 1 - 5
  3. //Round 2 Melbourne City -Brisbane Roar 2 - 0
  4.  
  5. void Main()
  6. {
  7.  
  8. var matches = new[]
  9. {
  10. new
  11. {
  12. Round = 1,
  13. Home = "Melbourne City",
  14. Away = "Brisbane Roar",
  15. Score = "2 - 0",
  16. },
  17. new
  18. {
  19. Round = 1,
  20. Home = "Central Coast",
  21. Away = "Newcastle Jest",
  22. Score = "1 - 5",
  23. },
  24. new
  25. {
  26. Round = 2,
  27. Home = "Melbourne City",
  28. Away = "Brisbane Roar",
  29. Score = "2 - 0",
  30. },
  31. };
  32.  
  33. var query = from match in matches
  34. group match by match.Round into groupings
  35. select new
  36. {
  37. Round = groupings.Key,
  38. Games = from grouping in groupings
  39. select new
  40. {
  41. grouping.Home,
  42. grouping.Away,
  43. grouping.Score,
  44. }
  45. };
  46.  
  47.  
  48. query.Dump();
  49. }
Add Comment
Please, Sign In to add comment