C# sort dictionary with linq
You can do that using:
List<Product> productList = dictionary.OrderByDescending(kp => kp.Value)
.Select(kp => kp.Key)
.ToList();
MyDict.OrderByDescending(x => x.Value).Select(p => p.Key).ToList();
Try this
List<Product> productList = dictionary.OrderByDescending(x => x.Value).Select(x => x.Key).ToList();