When calling the GetRange
of a list, where it calls 10 in 10 list values at a time, however, it gives the following error:
Offset and length were out of bounds for the array or count greater than the number of elements from index to the end of the source collection.
As he calls 10 out of 10 if he finishes the list and does not contain the 10 he happens the error, how can I do that when calling 10 if he does not contain 10 within the list he takes the remainder to contain thus avoiding the error .
foreach (var item in lst.GetRange(count, index))
{
//count e index e incrementado +10 quando passa novamente começa do (0,9)
//aqui inseri os valores no cshtml
}