/// <summary> /// Returns a value indicating whether two <see cref="PersonName"/> are the same. /// </summary> /// <param name="other">Another <see cref="PersonName"/> to compare with</param> /// <param name="options">Comparison option</param> /// <returns> /// <b>true</b> if this person's name is the same as the other. <b>false</b> otherwise. /// </returns> public bool AreSame(PersonName other, PersonNameComparisonOptions options) { if (other == null) { return(false); } return (SingleByte.AreSame(other.SingleByte, options) && Phonetic.AreSame(other.Phonetic, options) && Ideographic.AreSame(other.Ideographic, options)); }
/// <summary> /// Returns a value indicating whether two <see cref="ComponentGroup"/> are the same. /// </summary> /// <param name="other"></param> /// <param name="options"></param> /// <returns></returns> public bool AreSame(ComponentGroup other, PersonNameComparisonOptions options) { if (other == null) { return(false); } if (IsEmpty) { return(other.IsEmpty); } else { return(AreSame(FamilyName, other.FamilyName, options) && AreSame(GivenName, other.GivenName, options) && AreSame(MiddleName, other.MiddleName, options) && AreSame(Prefix, other.Prefix, options) && AreSame(Suffix, other.Suffix, options)); } }
static private bool AreSame(string x, string y, PersonNameComparisonOptions options) { if (String.IsNullOrEmpty(x)) { return(String.IsNullOrEmpty(y)); } else { switch (options) { case PersonNameComparisonOptions.CaseSensitive: return(x.Equals(y)); case PersonNameComparisonOptions.CaseInsensitive: return(x.Equals(y, StringComparison.InvariantCultureIgnoreCase)); } return(false); } }
/// <summary> /// Returns a value indicating whether two <see cref="ComponentGroup"/> are the same. /// </summary> /// <param name="other"></param> /// <param name="options"></param> /// <returns></returns> public bool AreSame(ComponentGroup other, PersonNameComparisonOptions options) { if (other == null) return false; if (IsEmpty) return other.IsEmpty; else { return AreSame(FamilyName, other.FamilyName, options) && AreSame(GivenName, other.GivenName, options) && AreSame(MiddleName, other.MiddleName, options) && AreSame(Prefix, other.Prefix, options) && AreSame(Suffix, other.Suffix, options); } }
static private bool AreSame(string x, string y, PersonNameComparisonOptions options) { if (String.IsNullOrEmpty(x)) return String.IsNullOrEmpty(y); else { switch (options) { case PersonNameComparisonOptions.CaseSensitive: return x.Equals(y); case PersonNameComparisonOptions.CaseInsensitive: return x.Equals(y, StringComparison.InvariantCultureIgnoreCase); } return false; } }