Example #1
0
        private void OnScopeCompleted(object sender, EventArgs e)
        {
            var scope = (Scope)sender;

            scope.Completed -= OnScopeCompleted;
            instances.TryRemove(scope, out object removedInstance);
        }
Example #2
0
 private static Action Remove(ThreadSafeDictionary <string, string> dictionary)
 {
     return(() =>
     {
         Thread.Sleep(50);
         for (int i = 0; i < 50; i++)
         {
             string value;
             dictionary.TryRemove("Key", out value);
         }
     });
 }