interface ITestInterface { void Test(); } class TestClass : ITestInterface { void ITestInterface.Test() { throw new NotImplementedException(); } } class Program { static void Main(string[] args) { Type t = typeof(TestClass); MethodInfo method = t.GetMethod("Test"); } }
method为null,求破
可以这样
MethodInfo method = t.GetMethod("yournamespace.ITestInterface.Test", BindingFlags.Instance | BindingFlags.NonPublic);
不知道你要干嘛!