I am reading in files via File.ReadAllText into a stringbuilder. I am doing some replacements and regex, and then assigning it to textBox1.text. I then use Lines.Distinct() to remove duplicates. The result is perfect, expect there is one extra blank line (where the cursor is) at the end. I do not want this blank line, and want it removed so the textbox ends at the last line of text, not on a new blank line.
Share
One simple solution would be to
Trim()the string before assigning it as the value of the textbox.