System.Runtime.Remoting.RemotingServices.GetServerContext C# (CSharp) Method

GetServerContext() static private method

static private GetServerContext ( MarshalByRefObject obj ) : Context
obj System.MarshalByRefObject
return System.Runtime.Remoting.Contexts.Context
        internal static Context GetServerContext(MarshalByRefObject obj)
        {
            Context serverCtx = null;
            
            if(!IsTransparentProxy(obj) && (obj is ContextBoundObject))
            {
                // The object is native to the current context.
                serverCtx = Thread.CurrentContext;
            }
            else
            {
                RealProxy rp = GetRealProxy(obj);
                Identity id = rp.IdentityObject;
                ServerIdentity serverID = id as ServerIdentity;
                if(null != serverID)
                {
                    // The object was born in the current appdomain.
                    // Extract the server context.
                    serverCtx = serverID.ServerContext;
                }
            }
            
            return serverCtx;
        }
RemotingServices