It has been a few years since i have messed with C# or programming for that matter. I am attempting to read a CSV file to multiple integers. The CSV file is formatted as follows
box1,3
box2,6
box3,10
...
box160,1
So far for my code i have the below. The TextFieldParser i got off of another question. I am not sure if that is even what i need. I do not need to keep the information before the "," on the CSV file i just need the information after the "," to correspond with the correct int in my code. Any help or pointers would be much appreciated.
int box1;
int box2;
int box3;
...
int box160;
using (TextFieldParser parser = new TextFieldParser(@"C:\SprinklerTimer\DailySprinklerTimer.csv"))
{
parser.TextFieldType = FieldType.Delimited;
parser.SetDelimiters(",");
while (!parser.EndOfData)
{
//Processing row
string[] fields = parser.ReadFields();
foreach (string field in fields)
{
//TODO: Process field
}
}
}