/// <summary>
 /// Disposes of this enumerator and returns the stack reference to the resource pool.
 /// </summary>
 public void Dispose()
 {
     _root    = null !;
     _current = null;
     if (_stack != null && _stack.TryUse(ref this, out Stack <RefAsValueType <Node> >?stack))
     {
         stack.ClearFastWhenEmpty();
         s_enumeratingStacks.TryAdd(this, _stack !);
         _stack = null;
     }
 }
Example #2
0
            /// <summary>
            /// Disposes of this enumerator and returns the stack reference to the resource pool.
            /// </summary>
            public void Dispose()
            {
                _root    = null !;
                _current = null;
                if (_stack != null && _stack.TryUse(ref this, out Stack <RefAsValueType <Node> >?stack))
                {
                    stack.ClearFastWhenEmpty();
                    SecureObjectPool <Stack <RefAsValueType <Node> >, Enumerator> .TryAdd(this, _stack !);
                }

                _stack = null;
            }
            /// <summary>
            /// Disposes of this enumerator and returns the stack reference to the resource pool.
            /// </summary>
            public void Dispose()
            {
                _root    = null;
                _current = null;
                Stack <RefAsValueType <SortedInt32KeyNode <TValue> > > stack;

                if (_stack != null && _stack.TryUse(ref this, out stack))
                {
                    stack.ClearFastWhenEmpty();
                    s_enumeratingStacks.TryAdd(this, _stack);
                }

                _stack = null;
            }