I have theese classes:
public class BaseGrid
{
public int current { get; set; }
public int rowCount { get; set; }
public int total { get; set; }
public List<T> rows { get; set; }
}
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
}
Back in my controller, I´d like to do something like:
List<Product> listOfProducts = new List<Product>();
BaseGrid baseGrid = new BaseGrid();
baseGrid.rowCount = 10;
baseGrid.total = 20;
baseGrid.current = 1;
baseGrid.rows = listOfProducts;
How can I do to "rows" property became a generic list and in instance in runtime the baseGrid.rows to whatever list type I want?
Thanks.
Aucun commentaire:
Enregistrer un commentaire