using System.IO;
You need to rename a file.Unfortunately, there isno specific rename method that can be used to rename a file. Instead, you can use the static Move method of the File class or the instance MoveTo method of the FileInfo class. The static File.Move method can be used to rename a file in the following manner:
public static void RenameFile(string originalName, string newName)
{
File.Move(originalName, newName);
}
public static void Rename(FileInfo originalFile, string newName)
{
originalFile.MoveTo(newName);
}
منبع : "C# 3.0 Cookbook™, Third Edition"