Created
March 11, 2015 14:16
-
-
Save julesx/bc21947a26e4e1e1a692 to your computer and use it in GitHub Desktop.
GetMethod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Reflection; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
var temp = new Test(); | |
Console.ReadLine(); | |
} | |
} | |
class Test : BaseTest | |
{ | |
public Test() | |
{ | |
LoadMethod(); | |
} | |
} | |
class BaseTest | |
{ | |
public void LoadMethod() | |
{ | |
//WHY IS THIS NULL??? | |
var eventMethod = GetType().GetMethod("button_Click", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy); | |
} | |
private void button_Click(object sender, EventArgs e) | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment