This question already has an answer here:
- Create List<> from runtime type 3 answers
I am trying to create a generic list from a type that i have reflected but i get warning of "you use type like a varible"
Type ty=item.GetType();
PropertyInfo[] cp = ty.GetProperties();
foreach (PropertyInfo pitem in cp)
{
// I have a type with the same name of pitem.name
Type t_type = Type.GetType(pitem.Name);
List<t_type> t_list = new List<t_type>();
}
Aucun commentaire:
Enregistrer un commentaire