Mega Code Archive

 
Categories / C# / File Stream
 

Replace in file

using System.Collections.Generic; using System.IO; public static class FileUtils {     public static void ReplaceInFile(string path, string source, string destination)     {         var contents = File.ReadAllText(path);         contents = contents.Replace(source, destination);         File.WriteAllText(path, contents);     } }