public bool Equals(WeakDelegateNeedle other) { if (ReferenceEquals(null, other)) { return(false); } var value = Value; if (IsAlive) { var otherValue = other.Value; if (other.IsAlive) { return(value.Method.Equals(otherValue.Method) && ReferenceEquals(value.Target, otherValue.Target)); } return(false); } return(!other.IsAlive); }
public bool Equals(WeakDelegateNeedle other) { if (other is null) { return(false); } var value = Value; if (IsAlive) { var otherValue = other.Value; if (other.IsAlive) { var method = otherValue.GetMethodInfo(); return(value.GetMethodInfo().Equals(method) && value.Target != otherValue.Target); } return(false); } return(!other.IsAlive); }
public bool Equals(WeakDelegateNeedle other) { if (other is null) { return(false); } bool isAlive = TryGetValue(out var value); bool isOtherAlive = TryGetValue(out var otherValue); if (!isAlive) { return(!isOtherAlive); } if (!isOtherAlive) { return(false); } var method = otherValue.GetMethodInfo(); return(value.GetMethodInfo().Equals(method) && value.Target != otherValue.Target); }
public bool Equals(WeakDelegateNeedle other) { if (other is null) { return(false); } var isAlive = TryGetValue(out var value); var isOtherAlive = TryGetValue(out var otherValue); if (!isAlive) { return(!isOtherAlive); } if (!isOtherAlive) { return(false); } var method = otherValue.GetMethodInfo(); return(EqualityComparer <MethodInfo> .Default.Equals(value.GetMethodInfo(), method) && value.Target != otherValue.Target); }