Type type_class_a = ....;
Type type_class_b = type_class.GetField("name_b").FieldType;
MethodInfo method = type_nameb.GetMethod("method");
method.Invoke(type_class_b,new object[] {"test_string"});
in dll
public class class_a
{
public static class_b name_b = new class_b();
}
public class class_b
{
public void method(string data)
{
}
}
but i got error
An unhandled exception of type 'System.Reflection.TargetException' occurred in mscorlib.dll Additional information: Object does not match target type.
Then how to invoke it? Thankyou.
Aucun commentaire:
Enregistrer un commentaire