System.Runtime.Remoting.ObjectHandle.InitializeLifetimeService C# (CSharp) Méthode

InitializeLifetimeService() private méthode

private InitializeLifetimeService ( ) : Object
Résultat Object
        public override Object InitializeLifetimeService()
        {
            BCLDebug.Trace("REMOTE", "ObjectHandle.InitializeLifetimeService");

            //
            // If the wrapped object has implemented InitializeLifetimeService to return null,
            // we don't want to go to the base class (which will result in a lease being
            // requested from the MarshalByRefObject, which starts up the LeaseManager,
            // which starts up the ThreadPool, adding three threads to the process.
            // We check if the wrapped object is a MarshalByRef object, and call InitializeLifetimeServices on it
            // and if it returns null, we return null. Otherwise we fall back to the old behavior.
            //

            MarshalByRefObject mbr = WrappedObject as MarshalByRefObject;
            if (mbr != null) {
                Object o = mbr.InitializeLifetimeService();
                if (o == null)
                    return null;
            }
            ILease lease = (ILease)base.InitializeLifetimeService();
            return lease;
        }
    }