I am currently writing a program to scan through some files, find a string (or preferably keywords), Print the line to a file and count how many times it occurs. However each time I test the input string using an if statement, I get a positive result as long as the file contains some sort of text.
I am new to c# so it is probably a misunderstanding of the classes I'm using but any help will be appreciated.
Note: I am not at the stage of writing the results to a file yet, I am writing to the console for testing purposes.
using (StreamReader read = File.OpenText(file))
while ((line = read.ReadLine()) != null)
if (line.Contains("Test String")) ;