我試圖做一個字典遊戲,並且我有一個文本文件,每行大約有100,000個單詞。我有這個代碼:C#List或TextReader限制?
words = new List<Word>();
Console.WriteLine("Please wait, compiling words list...");
TextReader tr = new StreamReader(DICT);
string line = tr.ReadLine();
while (line != "" && line != null) {
words.Add(new Word(line));
line = tr.ReadLine();
}
Console.WriteLine("List compiled with " + words.Count + " words.");
但是,它停在40510字。爲什麼是這樣?我該如何解除這個問題?
謝謝。
我檢查了一個空行;但我怎麼能檢查空字符?編輯:Notepadd ++揭示更多... – Xenoprimate 2010-07-28 17:53:40