File.WriteAllText不保留换行符

Jis*_*han 4 .net c#

此代码的输出

string fileDateTime = "StepsGA-" + DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss") + ".txt";
string fname = System.IO.Path.Combine(System.Environment.CurrentDirectory, fileDateTime);
File.WriteAllText(fname, txtSteps.Text);
Run Code Online (Sandbox Code Playgroud)

不保留换行符.文本框的所有内容都以水平长行打印!我哪里出错了?谢谢 !

Jis*_*han 20

得到了答案!而不是\n我需要使用Environment.NewLine.