I have a list of string arrays:
List<string[]> parsedRaw = new List<string[]>();
This list contains lines read from the CSV, where parsedRaw [3] [5] will be the fifth item read from the third line of the CSV.
I know that I can find the number of rows in a list with:
parsedRaw.Count
But, given the row, how can I find the number of elements in this row? I am trying to run a test before entering a loop to read from a list to avoid the error "Index was outside the array", where the loop:
for (k = 0; k < nBytes; k++)
{
TheseBytes[k] = (byte)parsedRaw[i][StartInt + k];
}
I ran into a line error in CSV that contains fewer elements than others. Before introducing this loop, I need to check if parsedRaw [i] has at least βStartInt + nBytesβ elements.
Thanks for any suggestions!
source
share