/// <summary> /// Get the value of the specified name property /// </summary> /// <param name="name">The name property to retrieve</param> /// <param name="maxLen">The maximum length of the value to return. If the actual value is longer, it is <see cref="TextExtensions.Truncate(string, int)"/>d to the specified length.</param> /// <returns>Either <see cref="string.Empty"/> (for null or empty values) or the value of the name property truncated to the specified maxLen (if applicable).</returns> public string GetValue(PersonNameProperties name, int maxLen = 50) { switch (name) { case PersonNameProperties.First: return(First.HasValue() ? First.Truncate(maxLen) : string.Empty); case PersonNameProperties.Last: return(Last.HasValue() ? Last.Truncate(maxLen) : string.Empty); case PersonNameProperties.Middle: return(Middle.HasValue() ? Middle.Truncate(maxLen) : string.Empty); case PersonNameProperties.Nickname: return(Nickname.HasValue() ? Nickname.Truncate(maxLen) : string.Empty); case PersonNameProperties.Prefix: return(Prefix.HasValue() ? Prefix.Truncate(maxLen) : string.Empty); case PersonNameProperties.Suffix: return(Suffix.HasValue() ? Suffix.Truncate(50) : string.Empty); default: return(string.Empty); } }