I'm working a GUI project in C#, and i have this multi-lined textbox. Whenever something happens within the application, it outputs a line to the textbox, logging a small desc of what happened. I want to only display the last 100 or so entries to prevent memory or performance issues. What is the best way to do this? My current code is as so:
string[] CurrentLines = LogWindow.Lines;
Array.Reverse(CurrentLines);
Array.Resize<string>(ref CurrentLines, 100);
Array.Reverse(CurrentLines);
LogWindow.Lines = CurrentLines;
This whole method just seems really redundant and slow to me. Can anyone give me a better way please?