icomparable

How CompareTo method logic works in List sort function?

How CompareTo method logic works in List sort function. public class person : IComparable { string firstName; string lastName; public int CompareTo(object obj) { person otherPerson = (person)obj; if (this.lastName != otherPerson.lastName) return this.lastName.CompareTo(otherPerson.lastName); ...