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