运用
File.AppendAllText("c:\mytextfile.text", "This is the first line")
File.AppendAllText("c:\mytextfile.text", "This is the second line")
Run Code Online (Sandbox Code Playgroud)
如何将第二行文本显示在第一行下,就像我按下Enter键一样?这样做只需将第二行放在第一行旁边.
运用 Environment.NewLine
File.AppendAllText("c:\mytextfile.text", "This is the first line")
File.AppendAllText("c:\mytextfile.text", Environment.NewLine + "This is the second line")
Run Code Online (Sandbox Code Playgroud)
或者你可以使用 StreamWriter
Using writer As new StreamWriter("mytextfile.text", true)
writer.WriteLine("This is the first line")
writer.WriteLine("This is the second line")
End Using
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
32051 次 |
| 最近记录: |