When we used AppDomain.CreateInstance(‘Assembly name’, Type name) and my class inherits from MarshalByRefObject what happen internally? Is it create a TransparetnProxy?
Code:
class Greet : MarshalByRefObejct { ... } class test { public static void Main(string[] args) { AppDomain ad = AppDomain.CreateDomain('Second'); ObjectHandle hObj = ad.CreateInstance('Test', args[0]); .... } }
passing in args[0] = Greet
Yes, it creates a transparent proxy, which you get by unwrapping the object handle.
I find the documentation and example for
ObjectHandle.Unwrapis quite informative, as is the generalMarshalByRefObjectdocumentation.