Hi,
I have a List of Lat/Lon co-ordinates that I'm processing in a while(true) loop. During the loop I'm building a query that will be sent to a remote service for processing. The remote service can only accept 12 pairs of Lat/Lon co-ordinates, however my list may contain several thousand. What I want to do is build the query and then send it for processing every 12 loops.
List<string[]> lList = FromDB();
int i = 0;
int intLastIndex - lList.Count;
string strQuery = String.Empty
while(true)
{
strQuery = lList[i][0] + "|" + lList[i][1];
if(((i % 11) == 0) && (i != 0))
{
SendToRemoteService(strQuery);
strQuery = String.Empty;
}
if(i == intLastIndex)
{
break;
}
i++
}
However this generate an array out of bounds exception and will not process all records. Can anyone suggest a better approach?
Mark