I have a list of strings list and a number pageSize and pageNumber and a rowNumber, I want to split the list by the page size and creat a slit of lists, then return the element given at pageNumber and rowNumber. if the pageNumber and the rowNumber are above the possible index level, then a null value must be returned. both the pageNumber and the rowNumber are zero-based indexes
exmaple list = [1,2,3,4,5,6,7,8,9,10] pageSize = 3, pageNumber = 2 rowNumber = 1 Result:List = [[1.2.3].[4,5,6],[7,8,9], [10]] and the correct value is 8
i have made many attempts but this one was the nearest
public static int? GetItemInThePagedDataList(IEnumerable<int> list, int pageSize, int pageNumber, int rowNumber)
{
var lists = list.chop(pageSize);
if(pageNumber >=lists.count() || rowNumber >= lists.first().count())
throw new ArgumentOutofReachException();
return lists.elementAt(pageNumber).ElementAt(rowNumer);
}