diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-30 06:27:42 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-30 06:27:42 -0800 |
commit | dfbfeafaaeeda41242f0a5fc6e1de01e99889684 (patch) | |
tree | dd82dece2005963b940bc8edf4ed9b8476527cb4 | |
parent | 2591041a7ebacfeaebe40e3b91e1d95c8d32bd27 (diff) | |
download | DotNetOpenAuth-dfbfeafaaeeda41242f0a5fc6e1de01e99889684.zip DotNetOpenAuth-dfbfeafaaeeda41242f0a5fc6e1de01e99889684.tar.gz DotNetOpenAuth-dfbfeafaaeeda41242f0a5fc6e1de01e99889684.tar.bz2 |
Added Equals and GetHashCode methods to the HostMetaProxy class.
-rw-r--r-- | src/DotNetOpenAuth/OpenId/HostMetaDiscoveryService.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth/OpenId/HostMetaDiscoveryService.cs b/src/DotNetOpenAuth/OpenId/HostMetaDiscoveryService.cs index d4c8cac..e165680 100644 --- a/src/DotNetOpenAuth/OpenId/HostMetaDiscoveryService.cs +++ b/src/DotNetOpenAuth/OpenId/HostMetaDiscoveryService.cs @@ -452,6 +452,35 @@ namespace DotNetOpenAuth.OpenId { Contract.Requires<ArgumentNullException>(identifier != null); return string.Format(CultureInfo.InvariantCulture, this.SigningHostFormat, identifier.Uri.Host, this.GetProxy(identifier).Host); } + + /// <summary> + /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>. + /// </summary> + /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param> + /// <returns> + /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false. + /// </returns> + /// <exception cref="T:System.NullReferenceException"> + /// The <paramref name="obj"/> parameter is null. + /// </exception> + public override bool Equals(object obj) { + var other = obj as HostMetaProxy; + if (other == null) { + return false; + } + + return this.ProxyFormat == other.ProxyFormat && this.SigningHostFormat == other.SigningHostFormat; + } + + /// <summary> + /// Serves as a hash function for a particular type. + /// </summary> + /// <returns> + /// A hash code for the current <see cref="T:System.Object"/>. + /// </returns> + public override int GetHashCode() { + return this.ProxyFormat.GetHashCode(); + } } } } |