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 }
CompressedStack GetCompressedStack() { // Note: returns null if no CompressedStack has been set. // However CompressedStack.GetCompressedStack returns an // (empty?) CompressedStack instance. CompressedStack cs = ExecutionContext.SecurityContext.CompressedStack; return(((cs == null) || cs.IsEmpty()) ? null : cs.CreateCopy()); }
public CompressedStack GetCompressedStack() { #if MOBILE throw new NotSupportedException(); #else // Note: returns null if no CompressedStack has been set. // However CompressedStack.GetCompressedStack returns an // (empty?) CompressedStack instance. CompressedStack cs = ExecutionContext.SecurityContext.CompressedStack; return(((cs == null) || cs.IsEmpty()) ? null : cs.CreateCopy()); #endif }