本文翻译自:Reading CSV file and storing values into an array
I am trying to read a *.csv
-file. 我正在尝试读取*.csv
文件。
The *.csv
-file consist of two columns separated by semicolon (" ; "). *.csv
文件由两列组成,两列之间用分号(“ ; ”)分隔。
I am able to read the *.csv
-file using StreamReader and able to separate each line by using the Split()
function. 我能够使用StreamReader读取*.csv
文件,并能够通过使用Split()
函数分隔每一行。 I want to store each column into a separate array and then display it. 我想将每一列存储到一个单独的数组中,然后显示它。
Is it possible to do that? 有可能这样做吗?
#1楼
参考:https://stackoom.com/question/MALf/读取CSV文件并将值存储到数组中
#2楼
Just came across this library: https://github.com/JoshClose/CsvHelper 刚遇到此库: https : //github.com/JoshClose/CsvHelper
Very intuitive and easy to use. 非常直观