.net - 如何删除或关闭文件。如果它正在另一个进程中使用?
问题描述
case "Trend":
try
{
if (File.Exists(path + @"Trend.jpg"))
{
PublicClass.trendimage = "";
File.Delete(path + @"Trend.jpg");
}
else
{ }
objImage.SaveImage(path + @"Trend.jpg");
PublicClass.trendimage = path + @"Trend.jpg";
}
当我尝试使用代码删除文件时。它告诉我你不能删除它正在另一个进程中使用的文件。所以,请告诉我如何删除文件。
解决方案
推荐阅读
- android - 查看未找到不变违规
- python - XGBoost 的 ndcg 目标函数中的标签格式
- python-3.x - p2p文件共享python
- java - 如何在同一时间检测方法发布中的重复请求
- php - 存储在数据库中的 Laravel Eloquent 浮点值返回了额外的数字
- python - 按下空格时让精灵出现并在X秒后消失?
- python - 使用 ruby 根据目录名称创建文件并根据 Chef 中的远程目录名称创建目录
- javascript - 在 JavaScript 中比较不同格式的日期
- c# - WPF 验证错误一直存在,直到控制失去焦点
- matlab - Matlab:使用匿名函数求解二阶 ODE