I have to iterate over 1 Million items and my next action depends on successful iteration over those 1 Million items. As of now I am using While loop of C#, which is taking around 5-6 minutes to complete the iterations. Is there any way to speed up this processing? As later on I might have around 5-6 Million items to iterate.
System.IO.StreamReader file =
new System.IO.StreamReader("data.csv");
System.IO.StreamWriter jsonFile =
new System.IO.StreamWriter("jsonData.csv");
BBP obj;
var dataList = new Dictionary<string, dynamic>();
while ((line = file.ReadLine()) != null)
{
if (counter == 0)
{
columns = line.Split(',');
}
else
{
data = line.Split(',');
obj = new BBP();
obj.BBP_CR_PART_NO = data[0];
obj.BBP_RO_NO = data[1];
obj.BBP_BPR_TPN = data[2];
dataList.Add("item_" + counter, obj);
Console.WriteLine(counter);
}
counter++;
}