How to remove empty lines in a string in C#? I am generating some text files in C# (winforms) and for some reason there are some empty lines. How can I remove them after the
I found simple answer to this problem
YourradTextBox.Lines = YourradTextBox.Lines.Where(p => p.Length > 0).ToArray();
Adapted from Marco Minerva [MCPD] at: https://social.msdn.microsoft.com/Forums/windows/en-US/b1bb4107-4ad5-4cd3-bd20-9c2b3f9b31a6/delete-lines-from-multiline-textbox-if-its-contain-certain-string-c?forum=winforms&prof=required