My code looks like this;
using (StreamWriter w = File.AppendText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "drivers/etc/hosts")))
{
w.WriteLine("127.0.0.1 www.google.com");
}
I want get rid of duplicates in hosts file. How can I check if line exists and prevent appending it again?