I\'m trying to get the key of the maximum value in the Dictionary.
This is what I have so far:
double max          
        
Little extension method:
public static KeyValuePair GetMaxValuePair(this Dictionary source)
    where V : IComparable
{
    KeyValuePair maxPair = source.First();
    foreach (KeyValuePair pair in source)
    {
        if (pair.Value.CompareTo(maxPair.Value) > 0)
            maxPair = pair;
    }
    return maxPair;
}
     
Then:
int keyOfMax = myDictionary.GetMaxValuePair().Key;