/// <summary> /// Returns true if MsalAuthParameters instances are equal /// </summary> /// <param name="other">Instance of MsalAuthParameters to be compared</param> /// <returns>Boolean</returns> public bool Equals(MsalAuthParameters other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return ((ClientApplicationId == other.ClientApplicationId || ClientApplicationId != null && ClientApplicationId.Equals(other.ClientApplicationId)) && (ClientId == other.ClientId || ClientId != null && ClientId.Equals(other.ClientId)) && (Authority == other.Authority || Authority != null && Authority.Equals(other.Authority)) && (RedirectUri == other.RedirectUri || RedirectUri != null && RedirectUri.Equals(other.RedirectUri)) && (RequestedScopes == other.RequestedScopes || RequestedScopes != null && RequestedScopes.Equals(other.RequestedScopes)) && (Username == other.Username || Username != null && Username.Equals(other.Username)) && (Password == other.Password || Password != null && Password.Equals(other.Password)) && (TelemetryCorrelationId == other.TelemetryCorrelationId || TelemetryCorrelationId != null && TelemetryCorrelationId.Equals(other.TelemetryCorrelationId)) && (AuthorizationType == other.AuthorizationType || AuthorizationType != null && AuthorizationType.Equals(other.AuthorizationType))); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; // Suitable nullity checks etc, of course :) if (ClientApplicationId != null) { hashCode = hashCode * 59 + ClientApplicationId.GetHashCode(); } if (ClientId != null) { hashCode = hashCode * 59 + ClientId.GetHashCode(); } if (Authority != null) { hashCode = hashCode * 59 + Authority.GetHashCode(); } if (RedirectUri != null) { hashCode = hashCode * 59 + RedirectUri.GetHashCode(); } if (RequestedScopes != null) { hashCode = hashCode * 59 + RequestedScopes.GetHashCode(); } if (Username != null) { hashCode = hashCode * 59 + Username.GetHashCode(); } if (Password != null) { hashCode = hashCode * 59 + Password.GetHashCode(); } if (TelemetryCorrelationId != null) { hashCode = hashCode * 59 + TelemetryCorrelationId.GetHashCode(); } if (AuthorizationType != null) { hashCode = hashCode * 59 + AuthorizationType.GetHashCode(); } return(hashCode); } }
/// <inheritdoc /> public override int GetHashCode() { unchecked { // Choose large primes to avoid hashing collisions const int HashingBase = (int)2166136261; const int HashingMultiplier = 16777619; int hash = HashingBase; hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, EventId) ? EventId.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, TelemetryCorrelationId) ? TelemetryCorrelationId.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, EventName) ? EventName.GetHashCode() : 0); return(hash); } }