File.Copy 复制文件有时候会 退出程序 不同地方使用的时候也会退出程序。 调试看了一下, 是进去disp什么的释放资源了, 我都没有using啊? 请问大家这个怎么决解呢? 别的项目同样的代码可以实现的哦。
File.Copy(strFrom, strTo, true); /// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
File.Copy(strFrom, strTo, true); /// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
try
catch
并跟踪一下看看