I have an ASP.NET MVC project and i am trying to build a partial view building up a dynamic table based on a given list of model which has type of Object. In the partial view, i get display names of properties to create columns and values of properties to populate body of table by using reflection. If i give a certain class in the list everything is ok. But i would like to create it generic and i do it like this: "@model List".
For instance: One of the actions pass List, another one passes List
Here i need what type of model passed to the view. I found some solutions on stackoverflow.
Type type = list.GetType().GetGenericArguments()[0];
This code like gives me the type of Object. But i need the certain type coming with the type of Object. (X or Y)
How can i get information of this type?
Thanks for help.
Aucun commentaire:
Enregistrer un commentaire