/// <summary> /// Provides a representative hash code for objects of this type to spread out distribution /// in hash tables. /// </summary> /// <remarks>Objects which consider themselves to be Equal (a.Equals(b) returns true) are /// expected to have the same hash code. Objects which are not Equal may have the same /// hash code, but minimizing such overlaps helps with efficient operation of hash tables. /// </remarks> /// <returns> /// An int representing the hash code calculated for the contents of this object. /// </returns> public override int GetHashCode() { if (string.IsNullOrEmpty(Key) == false) { return(Key.GetHashCode()); } int myHash = FullyQualifiedUserName.GetHashCode(); return(myHash); }
/// <summary> /// Provides a representative hash code for objects of this type to spread out distribution /// in hash tables. /// </summary> /// <remarks>Objects which consider themselves to be Equal (a.Equals(b) returns true) are /// expected to have the same hash code. Objects which are not Equal may have the same /// hash code, but minimizing such overlaps helps with efficient operation of hash tables. /// </remarks> /// <returns> /// an int representing the hash code calculated for the contents of this object /// </returns> public override int GetHashCode() { //we're being a bit more strict about hash code to match our equality compare exactly if (string.IsNullOrEmpty(Key) == false) { return(Key.GetHashCode()); } if (string.IsNullOrEmpty(FullyQualifiedUserName) == false) { return(FullyQualifiedUserName.GetHashCode()); } return(base.GetHashCode()); }