public override int GetHashCode()
{
if (_isFrozen)
{
return _frozenHashCode;
}
// see Effective Java by Joshua Bloch
int hash = 17;
var keys = _credentialsStore.Keys.ToArray();
Array.Sort(keys);
foreach (var key in keys)
{
hash = 37 * hash + key.GetHashCode();
hash = 37 * hash + _credentialsStore[key].GetHashCode();
}
return hash;
}
/// <summary> /// Gets the hash code. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { if (_isFrozen) { return(_frozenHashCode); } // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + _connectionMode.GetHashCode(); hash = 37 * hash + _connectTimeout.GetHashCode(); hash = 37 * hash + _credentialsStore.GetHashCode(); hash = 37 * hash + ((_defaultCredentials == null) ? 0 : _defaultCredentials.GetHashCode()); hash = 37 * hash + _guidRepresentation.GetHashCode(); hash = 37 * hash + _ipv6.GetHashCode(); hash = 37 * hash + _maxConnectionIdleTime.GetHashCode(); hash = 37 * hash + _maxConnectionLifeTime.GetHashCode(); hash = 37 * hash + _maxConnectionPoolSize.GetHashCode(); hash = 37 * hash + _minConnectionPoolSize.GetHashCode(); hash = 37 * hash + _readPreference.GetHashCode(); hash = 37 * hash + ((_replicaSetName == null) ? 0 : _replicaSetName.GetHashCode()); hash = 37 * hash + _secondaryAcceptableLatency.GetHashCode(); foreach (var server in _servers) { hash = 37 * hash + server.GetHashCode(); } hash = 37 * hash + _socketTimeout.GetHashCode(); hash = 37 * hash + _useSsl.GetHashCode(); hash = 37 * hash + _verifySslCertificate.GetHashCode(); hash = 37 * hash + _waitQueueSize.GetHashCode(); hash = 37 * hash + _waitQueueTimeout.GetHashCode(); hash = 37 * hash + _writeConcern.GetHashCode(); return(hash); }