public void Add <TMessage>(WeakAction <TMessage> action) { dictionary.AddOrUpdate(typeof(TMessage), t => new HashSet <WeakActionBase> { action }, (t, l) => { l.UnionWith(new[] { action }); return(l); }); }
public void Register <TMessage>(object recipient, Action <TMessage> action, Func <TMessage, bool> filter) { var weakAction = new WeakAction <TMessage>(recipient, action, filter); weakActionsDictionary.Add(weakAction); }