I want to pass some parameters to function that is being called using reflection in a universal windows App. Below is the code which I tried and I am getting an exception "Object does not match target type.". please advice me.
public class myClass
{
public async void btn_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
Type type = Type.GetType("moto_Windows.Actions.NextViewAction");
object[] mParam = new object[] { 5, 10 };
await (dynamic)type.GetTypeInfo().GetDeclaredMethod("NextView").Invoke(type, mParam);
}
}
Aucun commentaire:
Enregistrer un commentaire