how do i sort the dictionaries on the keys in c?

var dict = new Dictionary<int, string>(){
  {1, "a"},
  {3, "c"},
  {2, "b"}
};

foreach (var k in dict.OrderByDescending(x => x.Key))
{
   Console.WriteLine(k);
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top