首页 > 解决方案 > .NET、C#、反射 GetMethod 返回 null(试图在第三方 dll 中获取方法)

问题描述

我正在尝试创建一个实例并在 DLL 中调用一个方法,但由于某种原因GetMethod返回null. 谁能告诉我这里有什么问题?

//this works fine
Type myDllType = Type.GetTypeFromProgID("Application.name");

//this works fine too
object dllInstance = Activator.CreateInstance(myDllType);

//this returns null,  I am 100% sure "methodmd" exists
MethodInfo methodCommand = myDllType.GetMethod("methodmd");

标签: c#.netreflection

解决方案


推荐阅读