Log.Info中下面的String.Format方法中的\ n打印" \ n"作为文本而不是开始新的行;为什么它不起作用?任何的想法?我怎样才能使它发挥作用?
Log.Info(String.Format("Some arguments : \n Since : {0}\nBefore: {1}\nLog file name : {2}", since, before,logFileName));
谢谢!
答案 0 :(得分:10)
在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));