public static List<TModel<T>> ConvertList<T>(int pg, int pagesize, List<T> list) { List<TModel<T>> models = new List<TModel<T>>(); int n = 0; int x = pg * pagesize; if (list.Count < pagesize) { x = pg * pagesize - pagesize + list.Count; } for (int i = (pg - 1) * pagesize; i < x; i++) { TModel<T> model = new TModel<T>(); int m = i + 1; model.keyid = m; model.propert = list[n]; models.Add(model); n++; } return models; } public class TModel<T> { public int keyid { get; set; } public T propert { get; set; } }