1
可以说我有一个Test.csv文件,该文件是C#字符串列表读取单个元素,Console.Read()问题
Screen Name,Tweet ID,Dates,Tweets
OilGasMalaysia,5.21E+17,10/13/2014,Dropping Oil Prices Send Shockwaves Through Energy Sector - http://t.co/2dne6NGwRE http://t.co/hRUXjEQGCz
OilBRK,5.22E+17,10/13/2014,Oil prices down in Asian trade as weak demand weighs: Oil prices fell in Asian trade Monday on growi... http://t.co/yuL4D0FPx7 #Oil #BRK
OilBRK,5.22E+17,10/13/2014,Oil prices down in Asian trade as weak demand weighs: SINGAPORE: Oil prices fell in Asian trade Mond... http://t.co/RNBIRiQCu3 #Oil #BRK
OilBRK,5.22E+17,10/13/2014,Oil price down again on growth fears: Global oil prices fall again with Brent crude at a near four-y... http://t.co/AHUrTYORK2 #Oil #BRK
OilBRK,5.22E+17,10/13/2014,Oil heads for four-year low on Saudi output signal: Brent crude oil fell below $88 a barrel on Monda... http://t.co/O4JUbdFQ5o #Oil #BRK
我有下面的程序,我想用Test.csv StreamReader的
加载static void Main(string[] args)
{
List<string> CsvFile = new List<string>();
int counter = 0;
string line;
// Read the file and display it line by line.
System.IO.StreamReader file =
new System.IO.StreamReader("Test.csv");
while ((line = file.ReadLine()) != null)
{
CsvFile.Add(line);
// Console.WriteLine(line);
counter++;
//Console.ReadLine();
}
file.Close();
for (int i = 0; i < CsvFile.Count; i++)
{
Console.Write(CsvFile[i].ToString() + "\n");
Console.Read();
}
}
每件事情都很好,文件正在加载到内存中,但是当它进入for循环时,每两个元素都显示在一行中,问题与Console.Read()相关。
问题: 如何显示下一个单个元素当用户使用循环按键时。
谢谢。