int IEqualityComparer <T> .GetHashCode(T obj) { WeakObject <T> wobj = obj as WeakObject <T>; if (wobj != null) { return(wobj.GetHashCode()); } return(RuntimeHelpers.GetHashCode(obj)); }
bool IEqualityComparer <T> .Equals(T x, T y) { WeakObject <T> wx = x as WeakObject <T>; if (wx != null) { x = wx.Target; } WeakObject <T> wy = y as WeakObject <T>; if (wy != null) { y = wy.Target; } return(Object.Equals(x, y)); }