Read all file content. Make a replacement with String.Replace
. Write content back to file.
string text = File.ReadAllText("test.txt");
text = text.Replace("some text", "new value");
File.WriteAllText("test.txt", text);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…