private string getEmotion(EmotionScores emotion) { KeyValuePair <string, float> bestMatch = new KeyValuePair <string, float>("", 0); foreach (KeyValuePair <string, float> item in emotion.ToRankedList()) { if (item.Value > bestMatch.Value) { bestMatch = item; } } return(bestMatch.Key + " (" + NumberHelpers.ToPercent(bestMatch.Value) + ")"); }