C# Encoding a text string with line breaks

前端 未结 4 1362
暖寄归人
暖寄归人 2021-02-01 12:46

in C# I have a string I am writing to the outputstream of the response. After I save this document and open it in Notepad++ or WordPad I get nicely formatted line breaks where

4条回答
  •  滥情空心
    2021-02-01 13:02

    Try this :

    string myStr = ...
    myStr = myStr.Replace("\n", Environment.NewLine)
    

提交回复
热议问题