string[] words = System.IO.File.ReadAllLines("word.txt"); var query = from word in words where word.Length > "abe".Length && word.StartsWith("abe") select word; foreach (var w in query.AsParallel()) { Console.WriteLine(w); }
Basically, word.txt contains 170,000 English words. Is there a collection class in C # that is faster than a string array for the above query? There will be no insertion or deletion, just search if the line starts with "abe" or "abdi".
Each word in the file is unique.
EDIT 1 This search will run potentially millions of times in my application. I also want to stick to LINQ for the collection request, because I might need an aggregate function.
EDIT 2 Words from the file are already sorted, the file will not change
source share