Skip to content

Instantly share code, notes, and snippets.

@julesx
Created March 11, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julesx/bc21947a26e4e1e1a692 to your computer and use it in GitHub Desktop.
Save julesx/bc21947a26e4e1e1a692 to your computer and use it in GitHub Desktop.
GetMethod
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