System.Collections.Concurrent.ConcurrentDictionary.Clear()

Here are the examples of the csharp api System.Collections.Concurrent.ConcurrentDictionary.Clear() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

936 Examples 7

19 Source : OBSWebsocket.cs
with MIT License
from BarRaider

public void Disconnect()
        {
            if (WSConnection != null)
            {
                // Attempt to both close and dispose the existing connection
                try
                {
                    WSConnection.Close();
                    ((IDisposable)WSConnection).Dispose();
                }
                catch { }
                WSConnection = null;
            }
            
            var unusedHandlers = responseHandlers.ToArray();
            responseHandlers.Clear();
            foreach (var cb in unusedHandlers)
            {
                var tcs = cb.Value;
                tcs.TrySetCanceled();
            }
        }

19 Source : ChromeSession.cs
with MIT License
from BaristaLabs

private void Dispose(bool disposing)
        {
            if (!m_isDisposed)
            {
                if (disposing)
                {
                    //Clear all subscribed events.
                    m_eventHandlers.Clear();
                    m_eventTypeMap.Clear();

                    if (m_sessionSocket != null)
                    {
                        m_sessionSocket.Dispose();
                        m_sessionSocket.Opened -= Ws_Opened;
                        m_sessionSocket.Error -= Ws_Error;
                        m_sessionSocket.MessageReceived -= Ws_MessageReceived;
                        m_sessionSocket = null;
                    }

                    if (m_messageQueue != null)
                    {
                        m_messageQueue.Complete();
                        m_messageQueue = null;
                    }

                    if (m_openEvent != null)
                    {
                        m_openEvent.Dispose();
                        m_openEvent = null;
                    }

                    if (m_responseReceived != null)
                    {
                        m_responseReceived.Dispose();
                        m_responseReceived = null;
                    }
                }

                m_isDisposed = true;
            }
        }

19 Source : IndexedDefinitions.cs
with MIT License
from bcssov

public void Dispose()
        {
            if (disposed)
            {
                return;
            }
            GC.SuppressFinalize(this);
            disposed = true;
            definitions.Clear();
            definitions = null;
            directoryKeys.Clear();
            directoryKeys = null;
            fileKeys.Clear();
            fileKeys = null;
            typeAndIdKeys.Clear();
            typeAndIdKeys = null;
            typeKeys.Clear();
            typeKeys = null;
            allFileKeys.Clear();
            allFileKeys = null;
            childHierarchicalDefinitions.Clear();
            childHierarchicalDefinitions = null;
            mainHierarchalDefinitions.Clear();
            mainHierarchalDefinitions = null;
            trie = null;
        }

19 Source : MockedConfluentConsumer.cs
with MIT License
from BEagle1984

private void ClearParreplacedionsreplacedignment()
        {
            replacedignment.ToList().ForEach(topicParreplacedion => replacedignment.Remove(topicParreplacedion));

            _currentOffsets.Clear();
            _storedOffsets.Clear();
            _lastParreplacedionEof.Clear();
        }

19 Source : TcpServer.cs
with Apache License 2.0
from beetlex-io

public void Dispose()
        {
            ClearSession();
            mInitialized = false;
            Status = ServerStatus.Closed;
            foreach (var item in Options.Listens)
                item.Dispose();
            if (mReceiveDispatchCenter != null)
                mReceiveDispatchCenter.Dispose();
            this.mProperties.Clear();
            Status = ServerStatus.Closed;

        }

19 Source : EventCenter.cs
with Apache License 2.0
from beetlex-io

public void Dispose()
        {
            mActionHadlers.Clear();
            mActorProxyMap.Clear();
            foreach (var item in mActorsCollection.Values)
            {
                item.Free(this, true);
            }
            mActorsCollection.Clear();
            if (mFreeTimer != null)
                mFreeTimer.Dispose();
        }

19 Source : HttpClusterApiBase.cs
with Apache License 2.0
from beetlex-io

public void Dispose()
        {
            if (mUploadNodeTimer != null)
                mUploadNodeTimer.Dispose();
            if (mDetectionTimer != null)
                mDetectionTimer.Dispose();
            mHandlers.Clear();

        }

19 Source : SocketIo.cs
with MIT License
from Beffyman

public void Close()
		{
			Emitters.Clear();
			Handler.Close();
		}

19 Source : Players.cs
with MIT License
from BerkanYildiz

public void Dispose()
        {
            if (this.IsDisposed)
            {
                return;
            }

            this.IsDisposed = true;

            if (this.Enreplacedies != null)
            {
                this.Enreplacedies.Clear();
            }

            this.Enreplacedies = null;
        }

19 Source : InMemoryCacheManager.cs
with MIT License
from bing-framework

public void Clear() => _cache.Clear();

19 Source : InMemoryCacheManager.cs
with MIT License
from bing-framework

public void Dispose()
        {
            _cache?.Clear();
            _taskTimer?.Dispose();
            _taskTimer = null;
        }

19 Source : ScopedDictionary.cs
with MIT License
from bing-framework

public void Dispose()
        {
            Idenreplacedy = null;
            this.Clear();
        }

19 Source : CallContext.cs
with MIT License
from bing-framework

public static void Clear() => _state.Clear();

19 Source : SysLoggerProvider.cs
with MIT License
from bing-framework

public void Dispose() => _loggers.Clear();

19 Source : BrowserConsoleLoggerProvider.cs
with MIT License
from BlazorExtensions

public void Dispose() => this.loggers?.Clear();

19 Source : ContentService.cs
with MIT License
from blish-hud

protected override void Unload() {
            _loadedTextures.Clear();
            _loadedBitmapFonts.Clear();
        }

19 Source : Gw2WebApiService.cs
with MIT License
from blish-hud

private async Task RefreshRegisteredKeys() {
            _characterRepository.Clear();

            foreach (SettingEntry<string> key in _apiKeyRepository.Cast<SettingEntry<string>>()) {
                await UpdateCharacterList(key);
            }

            await UpdateActiveApiKey();
        }

19 Source : Helpers.cs
with GNU General Public License v3.0
from BloodHoundAD

internal static void StartNewRun()
        {
            PingCache.Clear();
            _currentLoopTime = $"{DateTime.Now:yyyyMMddHHmmss}";
        }

19 Source : GH_AsyncComponent.cs
with MIT License
from blueherongis

public void RequestCancellation()
    {
      foreach (var source in CancellationSources)
      {
        source.Cancel();
      }

      CancellationSources.Clear();
      Workers.Clear();
      ProgressReports.Clear();
      Tasks.Clear();

      Interlocked.Exchange(ref State, 0);
      Interlocked.Exchange(ref SetData, 0);
      Message = "Cancelled";
      OnDisplayExpired(true);
    }

19 Source : GH_AsyncComponent.cs
with MIT License
from blueherongis

protected override void SolveInstance(IGH_DataAccess DA)
    {
      //return;
      if (State == 0)
      {
        if (BaseWorker == null)
        {
          AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Worker clreplaced not provided.");
          return;
        }

        var currentWorker = BaseWorker.Duplicate();
        if (currentWorker == null)
        {
          AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Could not get a worker instance.");
          return;
        }

        // Let the worker collect data.
        currentWorker.GetData(DA, Params);

        // Create the task
        var tokenSource = new CancellationTokenSource();
        currentWorker.CancellationToken = tokenSource.Token;
        currentWorker.Id = $"Worker-{DA.Iteration}";

        var currentRun = TaskCreationOptions != null
          ? new Task(() => currentWorker.DoWork(ReportProgress, Done), tokenSource.Token, (TaskCreationOptions)TaskCreationOptions)
          : new Task(() => currentWorker.DoWork(ReportProgress, Done), tokenSource.Token);

        // Add cancellation source to our bag
        CancellationSources.Add(tokenSource);

        // Add the worker to our list
        Workers.Add(currentWorker);

        Tasks.Add(currentRun);

        return;
      }

      if (SetData == 0)
      {
        return;
      }

      if (Workers.Count > 0)
      {
        Interlocked.Decrement(ref State);
        Workers[State].SetData(DA);
      }

      if (State != 0)
      {
        return;
      }

      CancellationSources.Clear();
      Workers.Clear();
      ProgressReports.Clear();
      Tasks.Clear();

      Interlocked.Exchange(ref SetData, 0);

      Message = "Done";
      OnDisplayExpired(true);
    }

19 Source : GH_AsyncComponent.cs
with MIT License
from blueherongis

protected override void BeforeSolveInstance()
    {
      if (State != 0 && SetData == 1)
      {
        return;
      }

      Debug.WriteLine("Killing");

      foreach (var source in CancellationSources)
      {
        source.Cancel();
      }

      CancellationSources.Clear();
      Workers.Clear();
      ProgressReports.Clear();
      Tasks.Clear();

      Interlocked.Exchange(ref State, 0);
    }

19 Source : TopicLookup.cs
with GNU General Public License v3.0
from bonarr

public void Clear()
        {
            _topics.Clear();
            _groupTopics.Clear();
        }

19 Source : CachedDictionary.cs
with GNU General Public License v3.0
from bonarr

public void Clear()
        {
            _items.Clear();
            _lastRefreshed = DateTime.MinValue;
        }

19 Source : Cached.cs
with GNU General Public License v3.0
from bonarr

public void Clear()
        {
            _store.Clear();
        }

19 Source : PackageViewController.cs
with MIT License
from bonsai-rx

public void UpdatePackageQuery()
        {
            iconCache.Clear();
            var prefix = SearchPrefix;
            var updateFeed = getUpdateFeed();
            var searchTerm = searchComboBox.Text;
            var pageSize = updateFeed || SelectedRepository == PackageManager.LocalRepository ? int.MaxValue - 1 : PackagesPerPage;
            if (!string.IsNullOrEmpty(prefix)) searchTerm = prefix + searchTerm;
            packageQuery = new PackageQuery(searchTerm, pageSize, GetPackageQuery(searchTerm, pageSize, updateFeed));
            packagePageSelector.SelectedPage = 0;
        }

19 Source : EventMonitor.cs
with Apache License 2.0
from BoundfoxStudios

public void Dispose()
        {
            foreach (IEventRecorder recorder in recorderMap.Values)
            {
                recorder.Dispose();
            }

            recorderMap.Clear();
        }

19 Source : MJpegServer.cs
with GNU General Public License v3.0
from bp2008

internal void ClearChallenges()
		{
			letsEncryptChallenges.Clear();
		}

19 Source : Manager.cs
with MIT License
from Bphots

public void RepopulateQueue()
        {
            if (App.CustomConfigurationSettings.UploadStrategy != _uploadStrategy)
            {
                _hotsApiProcessingQueue.Clear();
                _hotsweekProcessingQueue.Clear();
                if (App.CustomConfigurationSettings.UploadStrategy == UploadStrategy.UploadAll)
                {
                    Files.Where(x => x.NeedHotsApiUpdate()).Reverse().Map(x => _hotsApiProcessingQueue[x] = ProcessingStatus.None);
                    Files.Where(x => x.NeedHotsweekUpdate()).Reverse().Map(x => _hotsweekProcessingQueue[x] = ProcessingStatus.None);
                }
            }
            else
            {
                if (_uploadToHotsApi != UploadToHotsApi)
                {
                    _hotsApiProcessingQueue.Clear();
                    Files.Where(x => x.NeedHotsApiUpdate()).Reverse().Map(x => _hotsApiProcessingQueue[x] = ProcessingStatus.None);
                }

                if (_uploadToHotsweek != UploadToHotsweek)
                {
                    _hotsweekProcessingQueue.Clear();
                    Files.Where(x => x.NeedHotsweekUpdate()).Reverse().Map(x => _hotsweekProcessingQueue[x] = ProcessingStatus.None);
                }
            }
            
            _uploadStrategy = App.CustomConfigurationSettings.UploadStrategy;
            _uploadToHotsApi = UploadToHotsApi;
            _uploadToHotsweek = UploadToHotsweek;
            OnStatusChanged();
        }

19 Source : OcrUtil.cs
with MIT License
from Bphots

public void ClearProcessedPositions()
        {
            ProcessedPositions.Clear();
        }

19 Source : SimpleDiskCache.cs
with MIT License
from BretJohnson

public virtual async Task ClearAsync()
        {
            while (_fileWritePendingTasks.Count != 0)
            {
                await Task.Delay(20).ConfigureAwait(false);
            }

            try
            {
                Directory.Delete(_cachePath, true);
            }
            catch (DirectoryNotFoundException)
            {
            }

            Directory.CreateDirectory(_cachePath);
            _entries.Clear();
        }

19 Source : TwitchService.cs
with MIT License
from brian91292

internal void Stop()
        {
            lock (_initLock)
            {
                if (_isStarted)
                {
                    _isStarted = false;
                    _channels.Clear();
                    LoggedInUser = null;
                    _loggedInUsername = null;
                    _websocketService.Disconnect();
                }
            }
        }

19 Source : ContextStack.cs
with Apache License 2.0
from bugbytesinc

private async ValueTask removeRef()
        {
            var count = Interlocked.Decrement(ref _refCount);
            if (_parent == null)
            {
                if (count == 0)
                {
                    await Task.WhenAll(_channels.Values.Select(channel => channel.ShutdownAsync()).ToArray()).ConfigureAwait(false);
                    _channels.Clear();
                }
            }
            else
            {
                await _parent.removeRef().ConfigureAwait(false);
            }
        }

19 Source : ControlPanel.cs
with Apache License 2.0
from bytedreamer

public void Shutdown()
        {
            foreach (var bus in _buses.Values)
            {
                bus.ConnectionStatusChanged -= BusOnConnectionStatusChanged;
                bus.Close();
                
                foreach (byte address in bus.ConfigureDeviceAddresses)
                {
                    OnConnectionStatusChanged(bus.Id, address, false);
                }
            }
            _buses.Clear();

            foreach (var pivDataLock in _pivDataLocks.Values)
            {
                pivDataLock.Dispose();
            }
            _pivDataLocks.Clear();
        }

19 Source : CurvedUIHelper.cs
with MIT License
from Caeden117

public void Reset()
        {
            curvedControllerCache.Clear();
            CachedCanvas = null;
            cachedCanvasIsRootCanvas = false;
            cachedController = null;
            hasCachedData = false;
        }

19 Source : Monster.cs
with GNU General Public License v3.0
from caioavidal

public void Born(Location location)
        {
            damages.Clear();
            ResetHealthPoints();
            Location = location;
            State = MonsterState.Sleeping;
            OnWasBorn?.Invoke(this, location);
        }

19 Source : Monster.cs
with GNU General Public License v3.0
from caioavidal

public void Reborn()
        {
            if (Spawn is null) return;

            damages.Clear();
            ResetHealthPoints();
            Location = Spawn.Location;
            State = MonsterState.Sleeping;
            OnWasBorn?.Invoke(this, Spawn.Location);
        }

19 Source : InteractiveBrokersBrokerage.cs
with Apache License 2.0
from Capnode

private void RestoreDataSubscriptions()
        {
            List<Symbol> subscribedSymbols;
            lock (_sync)
            {
                subscribedSymbols = _subscribedSymbols.Keys.ToList();

                _subscribedSymbols.Clear();
                _subscribedTickers.Clear();
                _underlyings.Clear();
            }

            Subscribe(subscribedSymbols);
        }

19 Source : InteractiveBrokersAccountData.cs
with Apache License 2.0
from Capnode

public void Clear()
        {
            AccountProperties.Clear();
            CashBalances.Clear();
            AccountHoldings.Clear();
            FinancialAdvisorConfiguration.Clear();
        }

19 Source : PortfolioTargetCollection.cs
with Apache License 2.0
from Capnode

public void Clear()
        {
            _targets.Clear();
        }

19 Source : CashBook.cs
with Apache License 2.0
from Capnode

public void Clear()
        {
            _currencies.Clear();
            OnUpdate(UpdateType.Removed);
        }

19 Source : SecurityCache.cs
with Apache License 2.0
from Capnode

public void Reset()
        {
            _dataByType.Clear();
            _lastTickQuotes = new List<BaseData>();
            _lastTickTrades = new List<BaseData>();
        }

19 Source : SecurityManager.cs
with Apache License 2.0
from Capnode

public override void Clear()
        {
            _securityManager.Clear();
        }

19 Source : InsightCollection.cs
with Apache License 2.0
from Capnode

public void Clear()
        {
            _nextExpiryTime = null;
            _insights.Clear();
        }

19 Source : TimerDispatchHandler.cs
with MIT License
from capricornus-platform

public void Dispose()
        {
            _timer.Dispose();
            _state.Clear();
        }

19 Source : UniverseManager.cs
with Apache License 2.0
from Capnode

public void Clear()
        {
            _universes.Clear();
        }

19 Source : DefaultRoleManager.cs
with Apache License 2.0
from casbin

public virtual void Clear()
        {
            _allDomains.Clear();
            _defaultRoles.Clear();
            _allDomains[_defaultDomain] = _defaultRoles;
            _cachedAllDomains = null;
        }

19 Source : ConcurrentEnforceCache.cs
with Apache License 2.0
from casbin

public void Clear()
        {
            _memoryCache.Clear();
        }

19 Source : DefaultChannelGroup.cs
with Apache License 2.0
from cdy816

public void Clear()
        {
            this.serverChannels.Clear();
            this.nonServerChannels.Clear();
        }

19 Source : ValueChangedMemoryCacheProcesser3.cs
with Apache License 2.0
from cdy816

public void Dispose()
        {
            resetEvent.Close();
            closedEvent.Close();
            mChangedTags.Clear();
            mTags.Clear();
        }

19 Source : ValueChangedMemoryCacheProcesser3.cs
with Apache License 2.0
from cdy816

public void Clear()
        {
            mTags.Clear();
            mChangedTags.Clear();
            mCurrentCount = 0;
        }

See More Examples