StringBuilder新行添加2个字符

本文关键字:字符 2个 添加 新行 StringBuilder | 更新日期: 2023-09-27 18:11:53

我需要生成一个每行240个字符的文件,但是当我使用AppendLine时,他增加了2个字符,导致我的行是242个字符,可以帮助我吗?

p。S:我试过用环境软件。换行符和"' n"

StringBuilder新行添加2个字符

AppendLine追加Environment.NewLine。你应该在

处换行
int charCountBeforeNewLine = 240 - Environment.NewLine.Length;
Console.WriteLine(Environment.NewLine.Length); // 2