Ejemplo n.º 1
0
        public void Invoke(TEvent argument, InvariantObjectAndTAndGCHandle <TClosure> callback)
        {
#if NET6_0
            (object?Target, object?Dependent)tuple = callback.Token.TargetAndDependent;
            Utils.WeakExecuteActionLike(tuple.Target, tuple.Dependent, tuple.Dependent, callback.ValueT);
#else
            object?target = callback.Handle.Target;
            Utils.WeakExecuteActionLike(target, callback.Value, target, callback.ValueT);
#endif
        }
        public bool DoesMatch(InvariantObjectAndTAndGCHandle <object?> element)
        {
#if NET6_0
            (object?Target, object?Dependent)tuple = element.Token.TargetAndDependent;
            return(delegateComparer.Equals(@delegate, Utils.ExpectExactTypeOrNull <TDelegate>(tuple.Target)) &&
                   closureComparer.Equals(value, Utils.ExpectExactTypeOrNull <TValue>(element.ValueT)) &&
                   handleComparer.Equals(handle, Utils.ExpectExactTypeOrNull <THandle>(tuple.Dependent)));
#else
            return(delegateComparer.Equals(@delegate, Utils.ExpectExactType <TDelegate>(element.Value)) &&
                   closureComparer.Equals(value, Utils.ExpectExactTypeOrNull <TValue>(element.ValueT)) &&
                   handleComparer.Equals(handle, Utils.ExpectExactTypeOrNull <THandle>(element.Handle.Target)));
#endif
        }