Since the class PagedData<T>
has a constraint on the type parameter T
, you have to explicitly replicate that constraint on your own method:
public static PagedData<T> PagedResult<T>(this List<T> list) where T : class
{
//some logic and return result as type PagedData<T>
return null;
}
If you don't do this, it would be "possible" to call PagedResult<int>
but then it would be impossible for it to return a PagedData<int>
-- which is why the compiler complains.