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); } } } }
protected override void InvokeSubscription(Subscription subscription, DiagnosticSourceAssembly.IDynamicInvoker source) { subscription.Action(source, subscription.State); }