AppDomain ad = AppDomain.CreateDomain("AD #1");
MarshalByRefType mbrt = (MarshalByRefType)ad
.CreateInstanceAndUnwrap(Assembly.GetEntryAssembly().FullName, "MarshalByRefType");
mbrt.SomeMethod();
AppDomain.Unload(ad);
public class MarshalByRefType : MarshalByRefObject
{
public MarshalByRefType() { }
public void SomeMethod() { }
public MarshalByValType MethodWithReturn()
{
return new MarshalByValType();
}
}