alb*_*jan 4 c# reflection appdomain
因为并非我想要实例化的类中使用的所有类都是可序列化的,所以我无法解包.
这可能吗?
var appdom = AppDomain.CreateDomain(amServiceable.GetType().ToString());
var objectHandle = appdom.CreateInstance(amServiceable.GetType().Assembly.FullName,
amServiceable.GetType().FullName);
var plugin = objectHandle.Unwrap() as IPlugin //throws an error. that some class in not marked serializable.
Run Code Online (Sandbox Code Playgroud)
为了Unwrap在对象上使用该方法,它必须从中派生出来MarshalByRefObject.如果您想要操作的对象没有,那么唯一的另一种选择是使用不同MarshalByRefObject的操作来操纵另一个域中的对象
| 归档时间: |
|
| 查看次数: |
2832 次 |
| 最近记录: |