Is there a way to share an interface accross AppDomain boundaries? That is, can I reference an instance within another AppDomain within my process using a shared interface? I know one can use WCF with named pipes, but I’m wondering if there is a more direct (and simpler) way to communicate in an object oriented way.
Share
You can create a second AppDomain and pass a MarshalByRef object (presumably that inherits your interface) across the AppDomain boundary. Simple example is here:
http://msdn.microsoft.com/en-us/library/3c4f1xde.aspx
So in the example:
remoteWorker is an in instance in “New domain”. The variable remoteWorker in the calling domain is actually a TransparentProxy which marshals the calls to the real instance in the other app domain.