G
GKS001
Guest
Hi All,
I am processing a List in chunk as in code snippet below.
In production the List is around million items.
My question is will the following code snippet create more memory pressure on .NET as i skip and take items iteratively.
--sample code
var itemList = new List<string> { "Item#1", "Item#2", "Item#3", "Item#4", "Item#5", "Item#6", "Item#7", "Item#8", "Item#9" };
int nChunkIndex = 0;
int nChunkSize = 2;
do
{
List<string> tmpProcessingChunkList = itemList.Skip(nChunkIndex).Take(nChunkSize).ToList();
if (tmpProcessingChunkList.Count == 0)
break;
//Process chunk size
nChunkIndex += nChunkSize;
}
while (true);
Thanks!
Continue reading...
I am processing a List in chunk as in code snippet below.
In production the List is around million items.
My question is will the following code snippet create more memory pressure on .NET as i skip and take items iteratively.
--sample code
var itemList = new List<string> { "Item#1", "Item#2", "Item#3", "Item#4", "Item#5", "Item#6", "Item#7", "Item#8", "Item#9" };
int nChunkIndex = 0;
int nChunkSize = 2;
do
{
List<string> tmpProcessingChunkList = itemList.Skip(nChunkIndex).Take(nChunkSize).ToList();
if (tmpProcessingChunkList.Count == 0)
break;
//Process chunk size
nChunkIndex += nChunkSize;
}
while (true);
Thanks!
Continue reading...