c# 文件另存为代码

利用.NET中的File.Copy方法

命名空间:System.IO

重载列表:Copy(string sourceFilePath,string targetFilePath)

     sourceFilePath:要复制的文件路径。

     targetFilePath:目标文件的路径,不能是目录和现有的文件

     如果目标文件已经存在,会产生IOException

      

     Copy(string sourceFilePath,string targetFilePath,bool overwrite)

     sourceFilePath:要复制的文件路径。

     targetFilePath:目标文件的路径,不能是目录

     overwrite :true表示可以覆盖目标文件,false表示不能覆盖目标文件

     

原文地址:https://www.cnblogs.com/MaFeng0213/p/6021038.html