当前位置:首页 > Windows程序 > 正文

c# 文件另存为代码

2021-03-11 Windows程序

利用.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表示不能覆盖目标文件

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/59363.html