Jam*_*Orr 21
从像ASpell(http://aspell.net/)这样的开源拼写检查程序中获取平面文本文件,并将其加载到List或您喜欢的任何结构中.
例如,
List<string> words = System.IO.File.ReadAllText("MyWords.txt").Split(new string[]{Environment.NewLine}).ToList();
// C# 3.0 (LINQ) example:
// get all words of length 5:
from word in words where word.length==5 select word
// get partial matches on "foo"
from word in words where word.Contains("foo") select word
// C# 2.0 example:
// get all words of length 5:
words.FindAll(delegate(string s) { return s.Length == 5; });
// get partial matches on "foo"
words.FindAll(delegate(string s) { return s.Contains("foo"); });
Run Code Online (Sandbox Code Playgroud)