I have been trying for days to write the last 5 five lines of the debug window into an external text file. No matter what I do, it fails. Now I am having issues with the third line from the bottom "
sb.ToString().Split('\n').Reverse()" underlined in red. The ERROR Reads: No overload for method 'Reverse' takes 0 arguments. I don't know what this means and I don't know how to fix it. Can someone please help.
using System;
using System.IO;
using System.Text;
using System.Diagnostics;
using System.Collections;
namespace Applica
{
static class Program
{
static void Main(string[] args)
{
byte[] data = new byte[] {1,2,3,4,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,101,108,111,13,10};
for (int i = 0; i < 28; i++)
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
TextWriterTraceListener myWriter = new TextWriterTraceListener(sw);
Debug.Listeners.Add(myWriter);
string output = string.Join("\n", sb.ToString().Split('\n').Reverse().Take(5).Reverse());
string path = @"c:\temp\Log.txt";
File.WriteAllText(path, output);
}
}
}
}