I am working on an app that should open a logfile and then it should be possible to:

1. output the whole file as it is
2. reverse the output
3. filter the output

I am outputting to a richtextbox since I also want to highlight specific lines.

I have tried both using ArrayList and StringBuilder. The latter seems better but then it is not so easy to reverse. To add all text to the RichTextBox I use RTB.Text. I have also thought of outputting all to a temp file and use RTB.LoadFile instead.

The problem is that the logfiles can be quite huge, >5MB in extreme cases. This causes it to be very slow and I also encounter out-of-index problems in certain situations that I have not been able to pin down in the debugger.

Could anyone advice me on the best way to get a stable and not to slow solution (since I have to work through the whole file line by line to filter it will never be quick)?