Aliendreamer

sorting a nested dictionary

Jun 3rd, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1.   var ordered = playerPositionSkill.OrderByDescending(x => x.Value.Values.Sum()).ThenBy(p => p.Key);
  2.         foreach (var player in ordered)
  3.         {
  4.             string name = player.Key;
  5.             int skills = player.Value.Values.Sum();
  6.             Console.WriteLine($"{name}: {skills}");
  7.             foreach (var positins in player.Value.OrderByDescending(x=>x.Value).ThenBy(x=>x.Key))
  8.             {
  9.                 Console.WriteLine($"{positins.Key} <::> {positins.Value}");
  10.             }
Advertisement
Add Comment
Please, Sign In to add comment