Last active
August 29, 2015 14:01
-
-
Save Injac/27dec8eedf9d46559ff4 to your computer and use it in GitHub Desktop.
Dynamic method invocation WinRT
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
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