score:3

Accepted answer

You can use the MaxBy method in MoreLINQ. There's a similar question already on StackOverflow (it's in C#, though). You can use it like:

Return dic.MaxBy(Function(pair) pair.Value).Key

score:0

I did this like this:

(From kvp In dic Select kvp Where kvp.Value = dic.Values.Max).First.Key

score:0

Old question but I thought I'd provide my LINQ VB answer in case it helps others.

Return dic.Aggregate(Function(l, r) If(l.Value > r.Value, l, r)).Key

Related Articles