What\'s the purpose for MarshalByRefObject?
Another important use of MarshalByRefObject
is for implementing AOP via remoting sink-chains.
If you have an object that derives from ContextBoundObject
(which itself derives from MarshalByRefObject
) you can instantiate it in a separate Context within the same AppDomain and have communications between objects automatically go through the Remoting proxy system - allowing you to plug custom sinks into the Remoting sink-chain.
This ultimately allows you to 'decorate' method calls to your objects and implement cross-cutting services, such as logging and security etc.