Advertisement
miroLLL

testSorting

Mar 2nd, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace _04Problem_RoliTheCoder
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             var test = new Dictionary<string, List<string> > ();
  12.  
  13.             List<string> nested = new List<string>();
  14.             List<string> nested1 = new List<string>();
  15.             List<string> nested2 = new List<string>();
  16.  
  17.             nested.Add("1");
  18.             nested.Add("2");
  19.             nested.Add("3");
  20.  
  21.             test.Add("firstString", nested);
  22.  
  23.             nested1.Add("aa");
  24.             nested1.Add("aa");
  25.             nested1.Add("aa");
  26.             nested1.Add("aa");
  27.             nested1.Add("aa");
  28.             nested1.Add("aa");
  29.             nested1.Add("aa");
  30.             nested1.Add("aa");
  31.  
  32.             test.Add("secondString", nested1);
  33.  
  34.             nested2.Add("ajahahha");
  35.             nested2.Add("ajahahha");
  36.             nested2.Add("ajahahha");
  37.             nested2.Add("ajahahha");
  38.  
  39.             test.Add("thirdString", nested2);
  40.  
  41.             foreach (var print in test.OrderByDescending(x => x.Value.Count()))
  42.             {
  43.                 Console.WriteLine($"Key -{print.Key}");
  44.                 Console.WriteLine($"Value - {string.Join(" ", print.Value)}");
  45.             }
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement