I'm trying to read in several string lines using stream reader, however I want to extract just the 4th line that is sent back when I make my query and display it in the console. Is there a better way of doing it rather than reading each line and saving it to a string. It's fine now as there's only 5 lines max being sent back but this would be terrible if I were to receive 10+ lines back.
All the lines are just plain text. Each time I receive from the server the lines are different so I have nothing to use as an id for a line.
sr is simply my stream reader that has been initialised like this:
StreamReader sr = new StreamReader(client.GetStream());
Below is my current method:
string Line1 = sr.ReadLine();
string Line2 = sr.ReadLine();
string Line3 = sr.ReadLine();
string Line4 = sr.ReadLine();
Console.WriteLine(Line4);