79334746

Date: 2025-01-07 02:01:15
Score: 1.5
Natty:
Report link

What works for me after changing a bit of the code from @Danial

int lineCount = LogTextBox.LineCount;
if (lineCount > 300)
{
     int excessLines = lineCount - 300;

     var text = LogTextBox.Text;
     int removeIndex = 0;

     for (int i = 0; i < excessLines; i++)
     {
     removeIndex = text.IndexOf(Environment.NewLine, removeIndex) + 
     Environment.NewLine.Length;
     }
LogTextBox.Text = text.Substring(removeIndex);
}
Reasons:
  • Whitelisted phrase (-1): works for me
  • Has code block (-0.5):
  • User mentioned (1): @Danial
  • Self-answer (0.5):
  • Starts with a question (0.5): What
  • Low reputation (1):
Posted by: fahrizkhan