Using System.Reflection

2019-08-30 02:31发布

Im loading an Exe into my application using Assembly.LoadFile(). From that is it possible to get the Method of a particular class from that EXE. Thanks in advance .

2条回答
beautiful°
2楼-- · 2019-08-30 03:01

Try:

    var assembly = Assembly.LoadFile("C:\path-to-some-app.exe");
    var desiredType = assembly.GetType("SomeNamespace.SomeClass");
    var methodInfo = desiredType.GetMethod("MethodName");
查看更多
仙女界的扛把子
3楼-- · 2019-08-30 03:07

A number of things you can do with Reflection (Including constructors, method invocation etc.) Tutorial at : http://www.csharp-examples.net/reflection-examples/

查看更多
登录 后发表回答