public override bool Equals(object obj) { PhoneNumber other = obj as PhoneNumber; if (other == null) { return(false); } if (hasCountryCode != other.hasCountryCode || (hasCountryCode && !countryCode_.Equals(other.countryCode_))) { return(false); } if (hasNationalNumber != other.hasNationalNumber || (hasNationalNumber && !nationalNumber_.Equals(other.nationalNumber_))) { return(false); } if (hasExtension != other.hasExtension || (hasExtension && !extension_.Equals(other.extension_))) { return(false); } // Manual fix to behave like the Java version which ignores the hasItalianLeadingZero fields if (!italianLeadingZero_.Equals(other.italianLeadingZero_)) { return(false); } if (hasRawInput != other.hasRawInput || (hasRawInput && !rawInput_.Equals(other.rawInput_))) { return(false); } if (hasCountryCodeSource != other.hasCountryCodeSource || (hasCountryCodeSource && !countryCodeSource_.Equals(other.countryCodeSource_))) { return(false); } if (hasPreferredDomesticCarrierCode != other.hasPreferredDomesticCarrierCode || (hasPreferredDomesticCarrierCode && !preferredDomesticCarrierCode_.Equals(other.preferredDomesticCarrierCode_))) { return(false); } return(true); }
public override bool Equals(object obj) { PhoneNumber other = obj as PhoneNumber; if (other == null) { return(false); } if (hasCountryCode != other.hasCountryCode || (hasCountryCode && !countryCode_.Equals(other.countryCode_))) { return(false); } if (hasNationalNumber != other.hasNationalNumber || (hasNationalNumber && !nationalNumber_.Equals(other.nationalNumber_))) { return(false); } if (hasExtension != other.hasExtension || (hasExtension && !extension_.Equals(other.extension_))) { return(false); } if (hasItalianLeadingZero != other.hasItalianLeadingZero || (hasItalianLeadingZero && !italianLeadingZero_.Equals(other.italianLeadingZero_))) { return(false); } if (hasNumberOfLeadingZeros != other.hasNumberOfLeadingZeros || (hasNumberOfLeadingZeros && !numberOfLeadingZeros_.Equals(other.numberOfLeadingZeros_))) { return(false); } if (hasRawInput != other.hasRawInput || (hasRawInput && !rawInput_.Equals(other.rawInput_))) { return(false); } if (hasCountryCodeSource != other.hasCountryCodeSource || (hasCountryCodeSource && !countryCodeSource_.Equals(other.countryCodeSource_))) { return(false); } if (hasPreferredDomesticCarrierCode != other.hasPreferredDomesticCarrierCode || (hasPreferredDomesticCarrierCode && !preferredDomesticCarrierCode_.Equals(other.preferredDomesticCarrierCode_))) { return(false); } return(true); }