开发者

Using System.Reflection

开发者 https://www.devze.com 2023-01-26 16:34 出处:网络
Im loading an Exe into my application using Assembly.LoadFile(). From that is it possible to开发者_Go百科 get the Method of a particular class from that EXE.

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


Try:

    var assembly = Assembly.LoadFile("C:\path-to-some-app.exe");
    var desiredType = assembly.GetType("SomeNamespace.SomeClass");
    var methodInfo = desiredType.GetMethod("MethodName");


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

0

精彩评论

暂无评论...
验证码 换一张
取 消