System.Threading.CompressedStack.CreateCopy C# (CSharp) Method

CreateCopy() public method

public CreateCopy ( ) : CompressedStack
return CompressedStack
        public CompressedStack CreateCopy()
        {
            return this;
        }

Same methods

CompressedStack::CreateCopy ( ) : System.Threading.CompressedStack

Usage Example

        static public CompressedStack GetCompressedStack()
        {
#if !FEATURE_COMPRESSEDSTACK
            throw new NotSupportedException();
#else
            // Note: CompressedStack.GetCompressedStack doesn't return null
            // like Thread.CurrentThread.GetCompressedStack if no compressed
            // stack is present.

            CompressedStack cs = Thread.CurrentThread.ExecutionContext.SecurityContext.CompressedStack;
            if (cs == null || cs.IsEmpty())
            {
                cs = CompressedStack.Capture();
            }
            else
            {
                cs = cs.CreateCopy();
                // merge the existing compressed stack (from a previous Thread) with the current
                // Thread stack so we can assign "all of it" to yet another Thread
                CompressedStack newstack = CompressedStack.Capture();
                for (int i = 0; i < newstack._list.Count; i++)
                {
                    cs._list.Add(newstack._list [i]);
                }
            }
            return(cs);
#endif
        }
All Usage Examples Of System.Threading.CompressedStack::CreateCopy