当前位置:   article > 正文

C#使用Create创建文件后,报The Process cannot access the file because it is being used by another process的异常

the process cannot access the file

今天使用File.Create("dddd.txt");后,打开这个文件时报The Process cannot access the file because it is being used by another process的异常。在网上找到解决方法如下:

File.Create("dddd").Close();

如果不Close(),那么这个文件一直被创建进程占着,直到创建进程被关闭。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/215969
推荐阅读
相关标签
  

闽ICP备14008679号