public int CompareTo(Racer other) { int compare = LastName?.CompareTo(other?.LastName) ?? -1; if (compare == 0) { return(FirstName?.CompareTo(other?.FirstName) ?? -1); } return(compare); }
public int CompareTo([AllowNull] Racer other) { //先比较LastName int compare = LastName?.CompareTo(other?.LastName) ?? -1; //如果LastName相同就比较FirstName if (compare == 0) { return(FirstName?.CompareTo(other?.FirstName) ?? -1); } return(compare); }
public int CompareTo(object obj) { if (!(obj is Student st)) { return(0); } var firstCompare = FirstName?.CompareTo(st.FirstName) ?? 0; if (firstCompare != 0) { return(firstCompare); } var secondCompare = NumberCard.CompareTo(st.NumberCard); return(secondCompare == 0 ? DOB.CompareTo(st.DOB) : secondCompare); }
/// <summary>Compares to.</summary> /// <param name="other">The other.</param> /// <returns>System.Int32.</returns> public int CompareTo(PersonFixed other) { if (other == null) { return(1); } int result = 0; result = Address1.CompareTo(other.Address1); if (result != 0) { return(result); } result = Address2.CompareTo(other.Address2); if (result != 0) { return(result); } result = BornOn.CompareTo(other.BornOn); if (result != 0) { return(result); } result = CellPhone.CompareTo(other.CellPhone); if (result != 0) { return(result); } result = City.CompareTo(other.City); if (result != 0) { return(result); } result = Country.CompareTo(other.Country); if (result != 0) { return(result); } result = Email.CompareTo(other.Email); if (result != 0) { return(result); } result = FirstName.CompareTo(other.FirstName); if (result != 0) { return(result); } result = HomePhone.CompareTo(other.HomePhone); if (result != 0) { return(result); } result = Id.CompareTo(other.Id); if (result != 0) { return(result); } result = LastName.CompareTo(other.LastName); if (result != 0) { return(result); } result = PostalCode.CompareTo(other.PostalCode); if (result != 0) { return(result); } return(result); }
/// <summary> /// Compares a person with another one. /// </summary> /// <param name="other">Other person to compare to.</param> /// <returns>-1 if the first name of the current person comes before the other person's, 0 if it's equal and 1 if it comes after</returns> public int CompareTo(Person other) { return(FirstName.CompareTo(other.FirstName)); }
public int CompareTo(Object obj) { Employee emp = (Employee)obj; return(FirstName.CompareTo(emp.FirstName)); }
public int CompareTo(ClubMember other) { return(FirstName.CompareTo(other.FirstName)); }
public int Compare(Person left, Person right) => .FirstName.CompareTo(right.FirstName);
public int CompareTo(UserProfile other) { return(FirstName.CompareTo(other.FirstName) == 0 ? LastName.CompareTo(other.LastName) : FirstName.CompareTo(other.FirstName)); }
public int CompareTo(PersonalDetails comparePersonalDetails) => comparePersonalDetails == null ? 1 : FirstName.CompareTo(comparePersonalDetails.FirstName);
public int CompareTo(Employee other) { return(FirstName.CompareTo(other.FirstName)); }
public int CompareTo(Name name) { return(this.Surname.Equals(name.Surname) ? FirstName.CompareTo(name.FirstName) : Surname.CompareTo(name.Surname)); }
int IComparable <Person> .CompareTo(Person other) { return(FirstName.CompareTo(other.FirstName)); }
public int CompareTo(object obj) { Player that = (Player)obj; return(PreferredPosition.CompareTo(that.PreferredPosition) + FirstName.CompareTo(that.FirstName)); }