How to find the key which has the highest value in a c# dictionary?

Viewed 399

I have a Dictionary and I want to find the key which has the highest value.

For example if I had

Key  |  Value
a    |   1
b    |   2
c    |   3

I would want c to be returned.

I have this at the moment but it only searches for the highest value, I'm not sure how to return the key.

var max = occurrences.Max(x => x.Value);
4 Answers
Related