Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace ConsoleApplication4
- {
- class Program
- {
- static void Main(string[] args)
- {
- var somethings = new List<Something>
- {
- new Something(1,2,3),
- new Something(2,8,5),
- new Something(1,1,4),
- new Something(4,3,5),
- new Something(2,6,3),
- new Something(2,2,5),
- new Something(1,3,5),
- new Something(3,2,2),
- new Something(3,7,4),
- };
- var q = somethings.GroupBy(g => g.A).OrderBy(g => g.Key).SelectMany(g => g.OrderBy(x => x.B));
- foreach (var item in q)
- {
- Console.WriteLine("{0} {1} {2}", item.A, item.B, item.C);
- }
- Console.ReadLine();
- }
- }
- class Something
- {
- public int A { get; set; }
- public int B { get; set; }
- public int C { get; set; }
- public Something(int a, int b, int c)
- {
- A = a;
- B = b;
- C = c;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement