Im trying to read a CSV into a 2d array, where the rows of CSV are the rows of the array, and the columns are defined by the separating commas in the file. It will be a rectangular array.
any help would be ace!
Jump to Post
You can read the file contents in line by line then use string.Split() to convert each row into a string array.
The following works provided that the array definitely has the same number of rows as columns:
string filePath = @"C:\Users\Dan\Documents\test.txt"; StreamReader sr = new StreamReader(filePath); string[,] strArray = …
All 3 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.