File类,有File.Copy()方法,你看看啊
解决方案 »
- 请问哪位大侠知道怎么在C\S的系统下使用样式
- 谁能翻译一下下面的文字
- 多线程操纵数据库 希望大家给一些意见
- 有没有在不同页面之间传递结构的好方法
- 使自已开发的WORD COM组件只在iexplorer.exe启动时加载
- WebForm中怎么用MessageBox?--我是真的没什么分了,才问了个问提话了我50,我穷啊
- debug一个C#的程序,如何在调试的时候能看到对应的MSIL汇编代码?
- 如何在两个窗体间传递DataTable(整个表)的数据.
- 怎么用C#定义Application 和Session对象啊?
- 在datagrid中,怎样点击表格时选中整行
- 从来没学过任何语言 现在想学C#有必要在学下C语言么。
- 关于 if else 的问题,求
using System.IO;class Test
{
public static void Main()
{
string path = @"c:\temp\MyTest.txt";
string path2 = path + "temp"; try
{
// Create the file and clean up handles.
using (FileStream fs = File.Create(path)) {} // Ensure that the target does not exist.
File.Delete(path2); // Copy the file.
File.Copy(path, path2);
Console.WriteLine("{0} copied to {1}", path, path2); // Try to copy the same file again, which should succeed.
File.Copy(path, path2, true);
Console.WriteLine("The second Copy operation succeeded, which was expected.");
} catch
{
Console.WriteLine("Double copy is not allowed, which was not expected.");
}
}
}