积极答复者
C#删除文件是如何跳过正在被其他进程所使用的文件

问题
答案
-
抓异常之后跳过……反正异常总是要抓的
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已建议为答案 Jason Dot WangModerator 2012年8月20日 9:26
- 已标记为答案 Jason Dot WangModerator 2012年8月24日 8:17
-
try { File.Delete(@"C:\1.txt"); } catch //如果文件无法删除就会引发异常 { //什么都不做 }
就是说使用try...catch,当文件无法删除时跳过处理共同努力,共同提高
kaedei#live.cn My BLOG- 已建议为答案 Jason Dot WangModerator 2012年8月20日 9:26
- 已标记为答案 Jason Dot WangModerator 2012年8月24日 8:17
全部回复
-
抓异常之后跳过……反正异常总是要抓的
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已建议为答案 Jason Dot WangModerator 2012年8月20日 9:26
- 已标记为答案 Jason Dot WangModerator 2012年8月24日 8:17
-
try { File.Delete(@"C:\1.txt"); } catch //如果文件无法删除就会引发异常 { //什么都不做 }
就是说使用try...catch,当文件无法删除时跳过处理共同努力,共同提高
kaedei#live.cn My BLOG- 已建议为答案 Jason Dot WangModerator 2012年8月20日 9:26
- 已标记为答案 Jason Dot WangModerator 2012年8月24日 8:17