【问题标题】:Using System.Reflection使用 System.Reflection
【发布时间】:2010-11-25 06:12:27
【问题描述】:

我正在使用 Assembly.LoadFile() 将一个 Exe 加载到我的应用程序中。 从中可以从该 EXE 中获取特定类的方法。 提前致谢。

【问题讨论】:

    标签: reflection c#-3.0


    【解决方案1】:

    试试:

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

    【讨论】:

      【解决方案2】:

      你可以用反射做很多事情(包括构造函数、方法调用等)教程在:http://www.csharp-examples.net/reflection-examples/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-06-01
        • 2012-11-29
        • 2014-02-14
        • 1970-01-01
        • 2011-02-27
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多