I loaded assemblies at runtime. I got type from loaded assembly. I created an object with this type but i need generic type of object. I got type of "object" not generic type, but i need that generic type. How can i cast object to that generic type?
Assembly asm = Assembly.Load("ExampleWebServices");
Type tp = asm.GetType("WebServices.Models.MyClass");
object myObjct =Activator.CreateInstance(tp);
When i try to cast like (tp)myObjct , i got error like "tp could not be found". Is there a way to return myObjct with type of tp?
Aucun commentaire:
Enregistrer un commentaire