+ 2
How can I Append some text to the beginning of file?
How can I Append some text to the beginning of file? File.AppendAllText() method appends text to the end of file. How can I append to beginning?
3 Antworten
+ 7
string currentContent = String.Empty;
if (File.Exists(filePath)) {
currentContent = File.ReadAllText(filePath); } File.WriteAllText(filePath, newContent + currentContent );
may be by this you can do that
+ 2
Try reading in the file and storing it in a variable then write over the file with the new text and append the stored.
+ 2
thanks for help