jeudi 28 janvier 2016

how to implement interface through reflection in c#

My Code is like
Assembly assemblyX = Assembly.Load("xyz.abc.DataObjects"); Type t = assemblyX.GetType("xyz.abc.DataObjects." + ValueStr); Everything is good till this point. Now i want to implement interface on 't' which is 'xDataObject' and require a generic i.e "CurrentDataObject" in < > operators like xDataObject<CurrentDataObject>. This interface consists many member functions, which I want to use in reflection. According to my research on it, the problem is in this next line, which works fine until we don't need interface i.e
Object objClass = (Object)Activator.CreateInstance(t);
Help me. I'm new to Generics. Thank you.





Aucun commentaire:

Enregistrer un commentaire