中心我有以下内容的文件:添加一行到文件
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也没有给出预期的结果。