C# MarshallByRefType
我尝试了一个示例,但得到了错误:C# MarshallByRefType,c#,.net,C#,.net,我尝试了一个示例,但得到了错误: Error 1 The type or namespace name 'MarshalByRefType' could not be found (are you missing a using directive or an assembly reference?) C:\Dropbox\development\snipplets-examples\dot.net\appdomain\MyAppDomain\MyAppDomain\Program.c
Error 1 The type or namespace name 'MarshalByRefType' could not be found (are you missing a using directive or an assembly reference?) C:\Dropbox\development\snipplets-examples\dot.net\appdomain\MyAppDomain\MyAppDomain\Program.cs 34 13 MyAppDomain
代码:
MarshalByRefType类的定义在您链接的页面中给出。是否应该是
MarshalByRefObject
?或者您的MarshalByRefType
是您定义的类型,并且:MarshalByRefObject
?
// Create an instance of MarshalbyRefType in the second AppDomain.
// A proxy to the object is returned.
MarshalByRefType mbrt =
(MarshalByRefType) ad2.CreateInstanceAndUnwrap(
exeAssembly,
typeof(MarshalByRefType).FullName
);