0
如何制作(列表单词)中的单词列表并用方法填充它void void void ReadWords(string,List。此方法必须获取文件的名称:文本和列表必须用此文件中的话如何使用streamreader从外部文件填充列表
那么,如何做到这一点
我开始用这样的:?
List<string> woorden = new List<string>();
// Read the file and display it line by line.
System.IO.StreamReader file = new System.IO.StreamReader("txt.txt");
int counter = 0;
while (!file.EndOfStream)
{
string woord = file.ReadLine();
for (int i = 0; i < woord.Length; i++)
counter++;
}
Console.WriteLine(counter);
file.Close();
Console.ReadKey();
你的问题不是很清楚......你需要什么?你卡在哪里? –