Skip to content

Instantly share code, notes, and snippets.

@Injac
Last active August 29, 2015 14:01
Show Gist options
  • Save Injac/27dec8eedf9d46559ff4 to your computer and use it in GitHub Desktop.
Save Injac/27dec8eedf9d46559ff4 to your computer and use it in GitHub Desktop.
Dynamic method invocation WinRT
private void Button_Click(object sender, RoutedEventArgs e)
{
Type objType = Type.GetType("TestReflection.CallMyMethods, TestReflection.WindowsPhone, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
TypeInfo mm = objType.GetTypeInfo();
var methods = mm.DeclaredMethods;
var instance = Activator.CreateInstance<CallMyMethods>();
foreach(var method in methods)
{
method.Invoke(instance, new object[] { });
}
}
}
public class CallMyMethods
{
public void TestOne()
{
}
public void TestTwo()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment