コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }