/// <summary> /// Converts the value of the specified <see cref="NycPublicOffice"/> to an abbreviated <see cref="String"/> representation. /// </summary> /// <returns>The abbreviated <see cref="String"/> equivalent of the value of this instance.</returns> public string ToAbbrevString() { switch (_type) { case NycPublicOfficeType.BoroughPresident: NycBorough borough; if (this.TryGetBorough(out borough)) { return(string.Format("{0} BP", CPConvert.ToString(borough))); } break; case NycPublicOfficeType.CityCouncilMember: return("City Council"); } return(CPConvert.ToString(_type)); }
/// <summary> /// Converts the value of the specified <see cref="NycPublicOffice"/> to its equivalent <see cref="String"/> representation. /// </summary> /// <returns>The <see cref="String"/> equivalent of the value of this instance..</returns> public override string ToString() { switch (_type) { case NycPublicOfficeType.BoroughPresident: NycBorough borough; if (this.TryGetBorough(out borough)) { return(string.Format("{0} {1}", CPConvert.ToString(borough), CPConvert.ToString(_type))); } break; case NycPublicOfficeType.CityCouncilMember: byte district; if (this.TryGetDistrict(out district)) { return(string.Format("{0}—District {1}", CPConvert.ToString(_type), district)); } break; } return(CPConvert.ToString(_type)); }
/// <summary> /// Gets an entity's full name with honorific title. /// </summary> /// <param name="entity">The entity whose honorific title is to be retrieved.</param> /// <returns>The full name with honorific title for <paramref name="entity"/>.</returns> public static string GetProperName(this Entity entity) { if (entity == null) { return(null); } string name = (entity.Honorific != Honorific.None) ? string.Format("{0} {1}", CPConvert.ToString(entity.Honorific), entity.Name) : entity.Name; return(name.Trim()); }