Reputation: 39364
I am using the project PagedList (https://github.com/troygoode/PagedList) on an ASP.NET MVC project and I have the following:
PagedList<TestModel> models = _service.Get(2, 20);
The service always return a PagedList but I need to create a List with only the items in PagedList and without the paging metadata.
I tried the following
IList<TestModel>)models.GetEnumerator()
No success. How can a PagedList be converted to List?
Upvotes: 1
Views: 1406
Reputation: 4862
Try
using System.Linq;
models.ToList()
The return type is List<TestModel>
.
Upvotes: 2