public List<string[]> parseCSV(string path)
{
List<string[]> parsedData = new List<string[]>();
try
{
using (StreamReader readFile = new StreamReader(path))
{
string line;
string[] row;
while ((line = readFile.ReadLine()) != null)
{
row = line.Split(',');
parsedData.Add(row);
}
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
return parsedData;
}
I want to use this code to parse a CSV, and this returns a List filled with arrays. My question is how do I iterate through the arrays within the list if they are of unknown size?
for example:
for (int a=0; a<=CSVList(firstindex).Length;a++)
for (int a=0; a<=CSVList(secondindex).Length;a++)
Something like this would read the first index of the CSVList and then the first array element in it...I think I am just really stuck on the syntax.
Thank you