Exemplo n.º 1
0
        /// <summary>
        /// Creates the <see cref="Subscriber{TPayload}"/>.
        /// </summary>
        /// <param name="subscriptionToken">The subscription token</param>
        /// <param name="synchronizationContext">The synchronization context</param>
        /// <param name="weakAction">The action</param>
        public Subscriber(SubscriptionToken subscriptionToken, SynchronizationContext synchronizationContext, WeakDelegate weakAction)
            : base(subscriptionToken, synchronizationContext)
        {
            if (weakAction == null)
            {
                throw new ArgumentNullException(nameof(weakAction));
            }

            this.weakAction = weakAction;

            var defaultFilter = new Func <TPayload, bool>(_ => true);

            this.weakFilter = new WeakDelegate(defaultFilter, false);
        }