Tek satırda yapabilirsiniz.
[CODE lang="csharp" highlight="3"]using System.IO // Standart .NET Dosya Giriş-Çıkış Kütüphanesi.
File.WriteAllText("dosya.txt", File.ReadAllText("dosya.txt").Replace("eskiYazi", "yeniYazi"));
[/CODE]
"dosya.txt" bizim dosyamız. Dosya yolu da kullanabilirsiniz.
Bulduğu her "eskiyazi" stringini "yeniyazi" stringiyle değiştirecek.
Kaynak:
Creates a new file, write the contents to the file, and then closes the file. If the target file already exists, it is truncated and overwritten.
docs.microsoft.com
Opens a text file, reads all the text in the file into a string, and then closes the file.
docs.microsoft.com