... edit ...
Using the dictionary named 'words shown below, and this function:
public List<string> GetExcludedLetterMatches(List<string> words, char ch)
{
return words.Where(wrd => ! wrd.Contains(ch)).ToList();
}
Look how easy it is to keep shrinking the working list by removing words containing the user's guessed letter:
List<string> workingList = words[8];
var noA = GetExcludedLetterMatches(workingList, 'a');
if (noA.Count > 0) workingList = noA;
var noE = GetExcludedLetterMatches(noA, 'e');
if (noE.Count > 0) workingList = noE;
This started with a list of the words whose length was #8 characters; then a list of words with no letter 'a was created, and that list was then filtered to exclude the letter 'e. Not shown here is the required code specific to the 'Hangman game, where, at the point there were no more "evil" options, you'd have to let the user see a match.
Note: the performance of this could be improved by using IEnumerables and deferred de-referencing.
... end edit ...
I can give you some ideas on how to organize the data you are working with for maximum re-use:
0. take the 'WordList file, put a comma at the end of each line; then strip out all the white-space and line endings.
1. create a Resource of Type 'String in your VS project, and paste in the edited 'WordList file content: title the new Resource: 'WordList
2. Organizing the data in the Resource"
private const int minChars = 5;
private const int maxChars = 12;
private Dictionary<int, List<string>> WordsByLength;
private void Form1_Load(object sender, EventArgs e)
{
WordsByLength = Resources.WordList.Split(new char[] {','})
.Where(wrd => wrd.Length >= minChars && wrd.Length <= maxChars)
.GroupBy(w => w.Length)
.ToDictionary(w => w.Key, w => w.ToList());
}
You end up with each Key in the dictionary representing the number of characters of the filtered lengths; the Value of each entry as a List of all the words of that length.