So, I'm trying to make a method that takes an input stream (from a text file), and churns out each word into it's own string, and sticks it into a list. According to my logic this should work, but (obviously) it doesn't. Any help would be appreciated :)
Code:
private void countWords() { bool isSpace; count = 0; //Will run as long as the files is real. if (textFile != null) { string line; StreamReader lines = new StreamReader(textFile); while ((line = lines.ReadLine()) != null) { //Makes sure the line isn't blank if (line.Trim().Length != 0) { isSpace = false; count++; //Adds to the count and adds to the list while(!isSpace) { if (string.Compare(line, blank) != 0) { lines.Read(); line = line + lines; } else { isSpace = true; } } randomOrder.Add(line); } } } }
Comment