gpt4 book ai didi

c# - 为什么\n 在 Log.Info 方法中不起作用?

转载 作者:太空狗 更新时间:2023-10-30 00:20:13 25 4
gpt4 key购买 nike

Log.Info 中下面的 String.Format 方法中的\n 将“\n”打印为文本而不是开始一个新行;为什么它不起作用?任何的想法?我怎样才能让它发挥作用?

Log.Info(String.Format("Some arguments : \n Since : {0}\nBefore: {1}\nLog file name : {2}", since, before,logFileName));

谢谢!

最佳答案

在 Windows 上,换行符实际上是 \r\n。尝试 Environment.NewLine:

Log.Info(String.Format("Some arguments : "+Environment.NewLine+" Since : {0}"+Environment.NewLine+"Before: {1}"+Environment.NewLine+"Log file name : {2}", since, before,logFileName));

关于c# - 为什么\n 在 Log.Info 方法中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13227249/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com