This question already has an answer here:
I have interface as Interface1 and classes like 'Swift','Audi' are implementation of this. While i am fetching object of interface through different kind of car as parameter and then i am trying to invoke method of one of them class ( which i got object) through reflection as below mentioned in code but getting error as 'Object reference'. Please help!
Interface1 swift = factoryclass.objectfind(factoryclass.cartype.Swift);
Type t = swift.GetType();
MethodInfo m = t.GetMethod("CalledMethod");
m.Invoke(swift, null);
Aucun commentaire:
Enregistrer un commentaire