string[] content = File.ReadAllLines("text.txt");
var words=content.SelectMany(line=>line.Split(' ', StringSplitOptions.RemoveEmptyEntries));
foreach(string word in words)
{
}
You will need to add any whitespace that you need. Using StringSplitOptions to handle consecutive spaces is cleaner than the Where clause I originally used.
In .net 4, you can use File.ReadLines for lazy evaluation and therefore lower RAM usage when working with large files.