public override int GetHashCode() { EqualsLog.Add( string.Format("Whos this asshole calling GetHashCode on my object? They're at: \n" + new StackTrace())); return(0); }
public override bool Equals(object obj) { if (obj == null) { EqualsLog.Add(string.Format(CalledUntypedEqualsOnNullOtherTemplate, Id)); return(false); } var objAsT = obj as EmptyOverridingEverythingItCan; if (objAsT == null) { EqualsLog.Add(string.Format(CalledUntypedEqualsOnNotThisTypeOtherTemplate, Id, obj.GetType())); return(false); } else { EqualsLog.Add(string.Format(CalledUntypedEqualsOnThisTypeOtherTemplate, Id, objAsT.Id)); return(true); } }
//this is the ONE AND ONLY Method IEquatable<T> demands you implement. //why doesnt it demand hashcode implementation? public bool Equals(IEmptyInterface other) { if (other == null) { EqualsLog.Add(string.Format(CalledTypedEqualsOnNullOtherTemplate, Id)); return(false); } var otherAsT = other as EmptyOverridingTypedEquality; if (otherAsT == null) { EqualsLog.Add(string.Format(CalledTypedEqualsOnNotThisTypeOtherTemplate, Id, other.GetType())); return(false); } else { EqualsLog.Add(string.Format(CalledTypedEqualsOnThisTypeOtherTemplate, Id, otherAsT.Id)); return(true); } }