public void Unsubscribe(global::System.Type messageType, PublishedMessageHandler messageHandler) { // TODO: This will probably throw an exception if no one has subscribed // to the message before PublishedMessageHandler handler = _messageHandlers[messageType]; handler -= messageHandler; if (handler == null) { _messageHandlers.Remove(messageType); } }
public void Subscribe(global::System.Type messageType, PublishedMessageHandler messageHandler) { PublishedMessageHandler handler = null; if (!_messageHandlers.TryGetValue(messageType, out handler)) { handler += messageHandler; _messageHandlers.Add(messageType, handler); } else { handler += messageHandler; } }