我想将此代码从java转换为C# 我需要从csv逐行写入并将其存储在数组中吗?
String csvFile = "data.csv";
String line = "";
String cvsSplitBy = ",";
try (BufferedReader br = new BufferedReader(new FileReader(csvFile)))
{
while ((line = br.readLine()) != null)
{
// use comma as separator
String[] data = line.split(cvsSplitBy);
System.out.println(Integer.parseInt(data[0]) + " "+data[1] + " "+data[2] );
}
}
catch (IOException e)
{
e.printStackTrace();
}
有什么建议吗?
答案 0 :(得分:1)
如果您尝试将每个记录/行解析为数组,这可能会有所帮助。
dplyr