Hey guys I'm having an issue with my logic in tackling this problem, I'm trying to split up files into 2000 entries per 'batch'. So once I reach 2000 ids, I create a new file (which is not listed in my code yet). But the deal is I should be able to select 8000 ids and it create 4 batch files containing 2000 ids in each.
int idCounter = 0;
private const int BATCH_COUNT = 2000;
// Incorrect logic
int numBatches = (idList.Count % BATCH_COUNT) + 1;
for (int j = 0; j < numBatches; j++)
{
_NumTotal = idList.Count;
for (int i = 0; i < BATCH_COUNT; i++)
{
if (idCounter == idList.Count)
{
break;
}
idCounter++;
}
}
Aucun commentaire:
Enregistrer un commentaire