我正在尝试确认该程序是否正常工作,有没有办法将这些数组的值输出到控制台?
using System;
using Microsoft.VisualBasic.FileIO;
class ReadingCSV
{
public static void Main()
{
string column1;
string column2;
var path = @"I:\Mfg\Process Engineering\User mfg\Tyler Gallop\CSV Reader\excel_test.csv";
using (TextFieldParser csvReader = new TextFieldParser(path))
{
csvReader.CommentTokens = new string[] { "#" };
csvReader.SetDelimiters(new string[] { "," });
csvReader.HasFieldsEnclosedInQuotes = true;
// Skip the row with the column names
csvReader.ReadLine();
while (!csvReader.EndOfData)
{
// Read current line fields, pointer moves to the next line.
string[] fields = csvReader.ReadFields();
column1 = fields[0];
column2 = fields[1];
}
}
}
}