public static HashSet<string> ReadWordList(bool keepOriginalCase, params string[] paths)
{
var culture = CultureInfo.CurrentCulture;
if (paths == null) throw new ArgumentNullException("paths");
HashSet<string> wordList = new HashSet<string>();
foreach (string path in paths)
{
using (StreamReader file = new StreamReader(path))
{
string word;
while (!file.EndOfStream)
{
word = file.ReadLine().Trim();
if (word != string.Empty && word[0]!='#' && !(word.Length>=2 && word[0]=='/' && word[1]=='/')) //ignore blank and commented lines
{
if (keepOriginalCase)
{
wordList.Add(word);
}
else
{
wordList.Add(word.ToLower(culture));
}
}
}
}
}
return wordList;
}