I'd like to make a C# application that reads from a file, looks for a specific string (word). I have no idea how that would go.
My file looks like this:
hostname: localhost
How can I read read the 'localhost' part only?
using (StreamReader sr = File.OpenText(config))
{
string s = "";
while ((s = sr.ReadLine()) != null)
{
string hostname = s;
Console.WriteLine(hostname);
}
}
^(up) Reads everything from a file.