System.Runtime.Remoting.Contexts.Context.Freeze C# (CSharp) Method

Freeze() private method

private Freeze ( ) : void
return void
        public virtual void Freeze()
        {
            lock(this) {
                if ((_ctxFlags & CTX_FROZEN) != 0)
                {
                    throw new InvalidOperationException(
                        Environment.GetResourceString(
                            "InvalidOperation_ContextAlreadyFrozen"));
                }
                InternalFreeze();
            }
        }
    

Usage Example

コード例 #1
0
        internal static Context CreateNewContext(IConstructionCallMessage msg)
        {
            // Create the new context

            Context newContext = new Context();

            foreach (IContextProperty prop in msg.ContextProperties)
            {
                if (newContext.GetProperty(prop.Name) == null)
                {
                    newContext.SetProperty(prop);
                }
            }
            newContext.Freeze();


            // Ask each context property whether the new context is OK

            foreach (IContextProperty prop in msg.ContextProperties)
            {
                if (!prop.IsNewContextOK(newContext))
                {
                    throw new RemotingException("A context property did not approve the candidate context for activating the object");
                }
            }

            return(newContext);
        }
All Usage Examples Of System.Runtime.Remoting.Contexts.Context::Freeze