public bool Remove(string key) { if (key == null) { throw new ArgumentNullException(nameof(key)); } bool result; IClient client = null; _syncLock.EnterWriteLock(); try { if (_clientDictionary.ContainsKey(key)) { client = _clientDictionary[key]; client.SlotsChanged -= OnInvalidate; client.RetrievalFinished -= OnInvalidate; client.Abort(); } result = _clientDictionary.Remove(key); } finally { _syncLock.ExitWriteLock(); } if (result) { IsDirty = true; OnClientConfigurationChanged(new ClientConfigurationChangedEventArgs(ClientConfigurationChangedAction.Remove, client)); } return(result); }