One way of doing it is;
string filename = "yourtextfilepath.txt";
if (File.Exists(filename))
{
string[] lines = File.ReadAllLines(filename);
Console.WriteLine(lines["the line number that you want to print - 1"]);
}
If you dont want to read all the lines here is another solution but you have to read all the previous line till to the desired line number:
string GetLine(string fileName, int line)
{
using (var sr = new StreamReader(fileName)) {
for (int i = 1; i < line; i++)
sr.ReadLine();
return sr.ReadLine();
}
}
Good luck,
OI