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 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);
}

Ehsan SajjadRank #512 · 4.8K reputationPosted Jul 17, 2017, 12:35 PM EDT
Roy Guzman18 reputationPosted Jul 17, 2017, 12:42 PM EDT
Mantu R6 reputationPosted Dec 13, 2017, 10:15 PM EST
Tapan PatelRank #614 · 3.9K reputationPosted Dec 14, 2017, 5:31 AM EST
int
>> listOfList = new Listint>>