public void Detach <TViewModelEventArgs>(string dispatcher, ViewModelEventHandler <TViewModelEventArgs> callback) where TViewModelEventArgs : ViewModelEventArgs { // [WARNING] Reflection used. May be slow. dispatcher = dispatcher ?? throw new ArgumentNullException("Dispatcher cannot be null."); callback = callback ?? throw new ArgumentNullException("Callback cannot be null."); Type ty = GetType(); EventInfo e = ty.GetEvent(dispatcher, BindingFlags.Instance | BindingFlags.Public); if (e.MemberType != MemberTypes.Event) { throw new SystemException("\'" + dispatcher + "\' is not a valid dispatcher."); } if (e == null) { throw new DispatcherNotFoundException("Could not find dispatcher \'" + dispatcher + "\"."); } if (callback.GetType() != e.EventHandlerType) { throw new DispatcherTypeMismatchException("Dispatcher type does not match with the callback type."); } e.RemoveEventHandler(this, callback); }