How to invoke static method from C# class without creating instance
I have code like this:
class Program
{
static void Main(string[] args)
{
Assembly myAsm = Assembly.LoadFile(@"c:\Some.dll");
Type myService = myAsm.GetType("SomeClass");
String s = (String) myService.InvokeMember("SomeMethod",
BindingFlags.InvokeMethod | BindingFlags.Public,
null, null, new object[] {"MyParam"});
}
}
In Some.Dll there is public static Method SomeMethod with String param
returning String but I get method missing Error...
No comments:
Post a Comment