read all text
string fileText = File.ReadAllText("filePath");
if (fileText.Contains("apple"))
{
Messagebox.Show("This word is exist");
}
else
{
Messagebox.Show("The word does not exist!");
File.AppendAllText(@"filePAth", "The word does not exixt in the text file" + Environment.NewLine);
}
1
solved How are going to read a text file and auto save in c # [closed]