System.Net.InterlockedStack.Push C# (CSharp) Метод

Push() приватный Метод

private Push ( Object pooledStream ) : void
pooledStream Object
Результат void
        internal void Push(Object pooledStream) {
            GlobalLog.Assert(null != pooledStream, "push null");
            if (null == pooledStream) { throw new ArgumentNullException("pooledStream"); }
            lock(_stack.SyncRoot) {
#if DEBUG
                GlobalLog.Assert(null == doublepush[pooledStream], "object already in stack");
                doublepush[pooledStream] = _stack.Count;
#endif
                _stack.Push(pooledStream);
#if DEBUG
                GlobalLog.Assert(_count+1 == _stack.Count, "push count mishandle");
#endif
                _count = _stack.Count;
            }
        }

Usage Example

        /// <devdoc>
        ///    <para>Places a new/reusable stream in the new stack of the pool</para>
        /// </devdoc>
        private void PutNew(PooledStream pooledStream)
        {
            GlobalLog.Enter("ConnectionPool#" + ValidationHelper.HashString(this) + "::PutNew", "#" + ValidationHelper.HashString(pooledStream));

            GlobalLog.Assert(null != pooledStream, "Why are we adding a null object to the pool?");
            GlobalLog.Assert(pooledStream.CanBePooled, "Non-poolable object in pool.");

            m_StackNew.Push(pooledStream);
            Semaphore.ReleaseSemaphore();
            GlobalLog.Leave("ConnectionPool#" + ValidationHelper.HashString(this) + "::PutNew");
        }
All Usage Examples Of System.Net.InterlockedStack::Push