中心我有以下內容的文件:添加一行到文件
This line number 1
I like playing football
This is the end
我只想第二行之後添加文本行:
This line number 1
I like playing football
I like eating pasta <------ this line shall be added
This is the end
是否有其他更簡單這樣做比保存所有行(讓我告訴,有n行)與n +1元素並將它們向下移動等。
作爲技術細節,我可以告訴我使用System.IO.StreamWriter
和System.IO.File
。
SO上的搜索引擎沒有給出我想看到的結果...... C#Reference也沒有給出預期的結果。