public int CompareTo(Name other) { int value = LastName.CompareTo(other.LastName); if (value != 0) { return(value); } value = FirstName.CompareTo(other.FirstName); if (value != 0) { return(value); } return(Honorific.CompareTo(other.Honorific)); }
/// <summary> /// Converts the value of the specified <see cref="Honorific"/> to its equivalent <see cref="String"/> representation. /// </summary> /// <param name="honorific">An honorific.</param> /// <returns>The <see cref="String"/> equivalent of the value of <paramref name="honorific"/>.</returns> public static string ToString(Honorific honorific) { switch (honorific) { case Honorific.Mr: return("Mr."); case Honorific.Mrs: return("Mrs."); case Honorific.Ms: return("Ms."); case Honorific.Rev: return("Rev."); case Honorific.Sister: return("Sister"); default: return(string.Empty); } }
public override string ToString() { List <string> nameParts = new List <string>(3); if (!string.IsNullOrWhiteSpace(Honorific) && !Honorific.Equals("--", StringComparison.InvariantCultureIgnoreCase)) { nameParts.Add(Honorific); } if (!string.IsNullOrWhiteSpace(FirstName)) { nameParts.Add(FirstName); } if (!string.IsNullOrWhiteSpace(LastName)) { nameParts.Add(LastName); } return(string.Join(" ", nameParts)); }
public void SetHonorific(Honorific honorific) { BarAccount.HNR = $"{honorific.ToString()}\\."; }
public void SetHonorific(Honorific honorific) { FooAccount.Honorific = honorific; }