コード例 #1
0
        public void Publish <T>(T eventData)
        {
            Type type = typeof(T);
            List <WeakReference> list = null;

            if (_subscriptions.TryGetValue(type, out list))
            {
                for (int index = list.Count - 1; index >= 0; index--)
                {
                    WeakReference    weakSubscription = list[index];
                    Subscription <T> item             = weakSubscription.Target as Subscription <T>;

                    if (item == null)
                    {
                        list.Remove(weakSubscription);
                    }
                    else
                    {
                        item.Action(eventData);
                    }
                }
            }
        }
コード例 #2
0
 protected override void InvokeSubscription(Subscription subscription, DiagnosticSourceAssembly.IDynamicInvoker source)
 {
     subscription.Action(source, subscription.State);
 }