Amib.Threading.CallerThreadContext.Apply C# (CSharp) Метод

Apply() публичный статический Метод

Applies the thread context stored earlier
public static Apply ( CallerThreadContext callerThreadContext ) : void
callerThreadContext CallerThreadContext
Результат void
        public static void Apply(CallerThreadContext callerThreadContext)
        {
            if (null == callerThreadContext)
            {
                throw new ArgumentNullException("callerThreadContext");
            }

            // Todo: In NET 2.0, redo using the new feature of ExecutionContext class - Run()
            // Restore call context
            if ((callerThreadContext._callContext != null) && (setLogicalCallContextMethodInfo != null))
            {
                setLogicalCallContextMethodInfo.Invoke(Thread.CurrentThread,
                                                       new object[] {callerThreadContext._callContext});
            }

            // Restore HttpContext
            if (callerThreadContext._httpContext != null)
            {
                CallContext.SetData(HttpContextSlotName, callerThreadContext._httpContext);
            }
        }