Rock.Model.DiscService.DetermineNaturalPersonalityType C# (CSharp) Method

DetermineNaturalPersonalityType() public static method

Determines the natural personality type. This is the highest score and the next highest if the score is over the midline (we're definining midline as over 24).
public static DetermineNaturalPersonalityType ( AssessmentResults results ) : string
results AssessmentResults The AssessmentResults
return string
        public static string DetermineNaturalPersonalityType( AssessmentResults results )
        {
            var personalityType = string.Empty;
            Dictionary<string, int> dictionary = new Dictionary<string, int>();
            dictionary["D"] = results.NaturalBehaviorD;
            dictionary["I"] = results.NaturalBehaviorI;
            dictionary["S"] = results.NaturalBehaviorS;
            dictionary["C"] = results.NaturalBehaviorC;

            List<KeyValuePair<string, int>> list = dictionary.ToList();
            list.Sort( ( x, y ) => y.Value.CompareTo( x.Value ) );
            personalityType = string.Format( "{0}{1}", list[0].Key, ( list[1].Value > 24 ) ? list[1].Key : string.Empty );
            return personalityType;
        }