public bool RemoveHandler(Subjects subject, SubjectDelegate handler) { lock (lockHandlers) { SubjectDelegate handlerDelegate; if (!SubjectHandlers.TryGetValue(subject, out handlerDelegate)) { return false; } handlerDelegate -= handler; return true; } }
public void RegisterHandler(Subjects subject, SubjectDelegate handler){ lock (lockHandlers) { SubjectDelegate handlerDelegate; if (SubjectHandlers.TryGetValue(subject, out handlerDelegate)) { handlerDelegate += handler; } else { SubjectHandlers.Add(subject, handler); } } }