/// <summary> /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. /// </summary> /// <returns> /// A signed integer that indicates the relative values of <paramref name="x"/> and <paramref name="y"/>, as shown in the following table.Value Meaning Less than zero<paramref name="x"/> is less than <paramref name="y"/>.Zero<paramref name="x"/> equals <paramref name="y"/>.Greater than zero<paramref name="x"/> is greater than <paramref name="y"/>. /// </returns> /// <param name="x">The first object to compare.</param><param name="y">The second object to compare.</param> public int Compare(Skill x, Skill y) { int intReturn; if (x?.SkillGroupObject != null) { intReturn = y?.SkillGroupObject?.Rating.CompareTo(x.SkillGroupObject.Rating) ?? -1; } else if (y?.SkillGroupObject != null) { intReturn = 1; } else { intReturn = 0; } if (intReturn == 0) { intReturn = SkillsSection.CompareSkillGroups(x?.SkillGroupObject, y?.SkillGroupObject); if (intReturn == 0) { intReturn = SkillsSection.CompareSkills(x, y); } } return(intReturn); }
/// <summary> /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. /// </summary> /// <returns> /// A signed integer that indicates the relative values of <paramref name="x"/> and <paramref name="y"/>, as shown in the following table.Value Meaning Less than zero<paramref name="x"/> is less than <paramref name="y"/>.Zero<paramref name="x"/> equals <paramref name="y"/>.Greater than zero<paramref name="x"/> is greater than <paramref name="y"/>. /// </returns> /// <param name="x">The first object to compare.</param><param name="y">The second object to compare.</param> public int Compare(Skill x, Skill y) { int intReturn = x?.SkillGroupObject != null ? y?.SkillGroupObject?.Rating.CompareTo(x.SkillGroupObject.Rating) ?? -1 : y?.SkillGroupObject != null ? 1 : 0; if (intReturn == 0) { intReturn = SkillsSection.CompareSkillGroups(x?.SkillGroupObject, y?.SkillGroupObject); if (intReturn == 0) { intReturn = SkillsSection.CompareSkills(x, y); } } return(intReturn); }