using System; using System.Collections.Generic; using System.Linq; namespace Test { class MainClass { public static void Main(string[] args) { var test = new Dictionary(); while(true) { var text = Console.ReadLine(); if (text == "exit") break; var input = text.Split('-'); string name = input[0]; int valueForObject = int.Parse(input[1]); string dictValue = input[1]; test.Add(new Thing(name, valueForObject), dictValue); } var result = test.OrderByDescending(x => x.Key.someProperty); foreach (var item in result) { Console.WriteLine($"Key property: {item.Key.someProperty}, Key name: {item.Key.name}, dict value: {item.Value}"); } } } class Thing { public int someProperty; public string name; public Thing(string name, int property) { someProperty = property; this.name = name; } } }