using System;
using System.IO;
class FileExample
{
public static void Main()
{
string OriginalFile = "test.xml";
string FileToReplace = "test2.xml";
ReplaceFile(OriginalFile, FileToReplace, "test3.xml");
}
public static void ReplaceFile(string FileToMoveAndDelete, string FileToReplace, string BackupOfFileToReplace)
{
File.Replace(FileToMoveAndDelete, FileToReplace, BackupOfFileToReplace, false);
}
}