I have a SortedDictionary how do I find the key associated with the max value? Do I have to loop through every KeyValuePair?
I have a SortedDictionary how do I find the key associated with the max
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If
dictis yourSortedDictionary<,>(or anyIDictionary<,>) and you want all the keys that correspond to the max value, first check thatdictis not null or empty (you need at least one element). Then maybe this works:Maybe it can be done more efficiently?