public static void RemoveExtensionMessageHandler(string extensionType, ExtensionMessageHandler handler) { if (extensionHandlers.ContainsKey(extensionType)) { List<ExtensionMessageHandler> handlers = extensionHandlers[extensionType]; handlers.Remove(handler); if (handlers.Count == 0) extensionHandlers.Remove(extensionType); } }
public static void RegisterExtensionMessageHandler(string extensionType, ExtensionMessageHandler handler) { List<ExtensionMessageHandler> handlers; if (extensionHandlers.ContainsKey(extensionType)) handlers = extensionHandlers[extensionType]; else handlers = new List<ExtensionMessageHandler>(); handlers.Add(handler); extensionHandlers[extensionType] = handlers; }