c# 文件另存为代码

Posted 山海之间

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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表示不能覆盖目标文件

     

以上是关于c# 文件另存为代码的主要内容,如果未能解决你的问题,请参考以下文章