Hi there, I'm creating a forms application that has a front end (the forms stuff) and controls a back end (external controller). That is not overly important - the problem I am having is that I want to be able to read all the debug comments that I have written to the console with Console.WriteLine into a List with the generic type String so that I can then pass them to another method to format, and eventually save as a text file whenever an error occurs.
Here is the method that will do this, am I on the right track?
CODE
private List<String> frontEndLog()
{
List<String> data = new List<String>();
// not working - should read console to a variable
StreamReader sr = new StreamReader(Console.OpenStandardInput(100));
using (sr)
{
String line = null;
do
{
// want to read the lines of sr here
data.Add(line);
}
while (line != null);
}
return data;
}
Many thanks in advance.