I have a list, the type of the object will be found only at the runtime through reflection. But when I try to assign the list to the actual entity, it is throwing error as "object cannot be converted". Below is the code,
`Var obj = New List<Object>();
obj.Add(cust1);
obj.Add(Cust2);
Type t = t.GetProperty("Customer").PropertyType// I will get type from property
var data= Convert.ChangeType(obj,t); //This line throws error`
Aucun commentaire:
Enregistrer un commentaire