简体   繁体   English

如何避免在RichTextbox的末尾添加空行?

[英]How can I avoid adding empty line to the end of RichTextbox?

foreach (string link in links)
{
    rtbPaths.AppendText(link + Environment.NewLine);
}
foreach (string link in links1)
{
    rtbPaths.AppendText(link + Environment.NewLine);
}

The problem is when the second foreach finishes there is an empty line at the bottom of the RichTextbox. 问题是当第二个foreach完成时,RichTextbox的底部有一个空行。 How can I make that it will not add the empty line at the end? 如何使它不会在末尾添加空行?

rtbPaths.AppendText(string.Join(Environment.NewLine, links));
rtbPaths.AppendText(Environment.NewLine);
rtbPaths.AppendText(string.Join(Environment.NewLine, links1));

or just 要不就

rtbPaths.AppendText(string.Join(Environment.NewLine, links.Concat(links1)));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM