Esempio n. 1
0
        public void ClearTest()
        {
            DoubleKeyDictionary <int, string, string> map = CreateDictionary();

            map.Clear();
            map.Count.AreEqualWith(0);
        }
Esempio n. 2
0
        internal void SaveCache()
        {
            LoadCache();
            try
            {
                string savePathDir   = GetCachePath();
                var    stringBuilder = new StringBuilder();

                foreach (KeyValuePair <int, string> entry in entriesFromRequests)
                {
                    stringBuilder.AppendLine($"{entry.Value}:{entry.Key}");
                }

                File.WriteAllText(savePathDir, stringBuilder.ToString());


                savePathDir   = GetDeactivatedCachePath();
                stringBuilder = new StringBuilder();

                foreach (KeyValuePair <int, string> entry in entriesFromFile)
                {
                    if (!entriesFromRequests.TryGetValue(entry.Value, out int v))
                    {
                        stringBuilder.AppendLine($"{entry.Value}:{entry.Key}");
                    }
                }

                File.WriteAllText(savePathDir, stringBuilder.ToString());
                entriesFromFile.Clear();
            }
            catch (Exception exception)
            {
                Logger.Error($"Caught exception while saving cache!{Environment.NewLine}{exception}");
            }
        }
 public virtual void Clear()
 {
     lock (m_objectEntitiesLock)
         m_objectEntities.Clear();
     lock (m_presenceEntitiesLock) {
         m_presenceEntitiesList.Clear();
         m_presenceEntities.Clear();
     }
     lock (m_child_2_parent_entitiesLock)
         m_child_2_parent_entities.Clear();
 }
        private bool disposedValue = false; // To detect redundant calls

        private void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    lock (dictionary)
                    {
                        foreach (var v in dictionary.Values.ToArray())
                        {
                            v.ForceDispose();
                        }
                        dictionary.Clear();
                    }
                }
                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
Esempio n. 5
0
 public void Clear()
 {
     _upLineSegment.Clear();
     _lowLineSegment.Clear();
     _sortedVertexes.Clear();
 }