这是我在 C# DLL 中的类
namespace MyNS
{
public class MyClass
{
public static int Execute(string logKey,
string key,
XmlNode xmlPars)
{
return 0
}
}
}
我在运行时加载 DLL 并将 Class Type 加载到 _type 变量中。但是当我从这样的 Windows 服务调用函数 Execute 时:
counter = (int)_type.InvokeMember("Execute",
BindingFlags.Public |
BindingFlags.InvokeMethod |
BindingFlags.Static,
null,
null,
new object[] {
logKey,
Key,
_xmlParams
});
我得到“异常已被调用的目标抛出。”
我在这里做错了什么?