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);
}
}
Related examples in the same category