可能是一个基本问题:
我经历过这个,
secondDomain.CreateInstance("AssemblyA", "AssemblyA.Demo", true,
System.Reflection.BindingFlags.CreateInstance, null,
new object[] { 7, 3 }, null, null);
并查看了评论形式的解释。
// Returns:
// An object that is a wrapper for the new instance specified by typeName. The
// return value needs to be unwrapped to access the real object.
MSDN:AppDomain.CreateInstance Method .
在此上下文中对象的包装器是什么?为什么要使用这个?如何打开这个?
最佳答案
您可以将包装器视为指向另一个对象的“c”或“c++”指针。 您可以使用 Unwrap 打开它。方法:
MyType testObj = (MyType) obj.Unwrap();
参见this link了解更多信息。
关于c# - 使用 AppDomain.CreateInstance 时实例的包装器是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14999483/