Name
MarshalByRefObject
Synopsis
MarshalByRefObject
is the base
class for objects that are marshaled by reference across
AppDomain
boundaries. If you
attempt to transmit an object that derives from this class
to another domain (e.g., as a parameter in a method
call to a remote machine), an object reference is sent. (In actuality, this is an object
proxy, which provides the same interface — methods, properties, and so
forth.)
If the other domain uses this reference (e.g., sets
an object property or calls one of its methods), the call
is automatically marshaled back to the original domain
in which the object was created, and it is invoked there, using the
proxy object the .NET Framework creates automatically.
You can inherit from this class to create a remotable object.
Values that should be marshaled by reference include
unmanaged pointers and file handles, which do not have any
meaning in another domain. Objects that are marshaled by
reference live until their lifetime lease expires.
The MarshalByRefObject
class includes
methods for getting and setting the
ILease
object from the System.Runtime.Remoting.Lifetime
namespace. More information about remoting can be found in the
System.Runtime.Remoting
namespace.
public abstract class MarshalByRefObject { // Protected Constructors protected method MarshalByRefObject(); // Public Instance Methods public virtual method ObjRef CreateObjRef( Type requestedType); public method object GetLifetimeService(); public virtual method object InitializeLifetimeService ...
Get C# in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.