Created
January 17, 2015 20:54
-
-
Save scionwest/47bafc0d9094cecffa4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private ConcurrentDictionary<Type, ConcurrentBag<ISubscription>> listeners = | |
| new ConcurrentDictionary<Type, ConcurrentBag<ISubscription>>(); | |
| public void Publish<T>(T message) where T : class, IMessage | |
| { | |
| if (!listeners.ContainsKey(typeof(T))) | |
| { | |
| return; | |
| } | |
| foreach (INotificationHandler<T> handler in listeners[typeof(T)]) | |
| { | |
| handler.ProcessMessage(message); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment