为什么我下载后无法删除文件?
我收到此错误:
文件'exfile.jpgg'因为它正由另一个进程使用.
这是我的代码,
string file_name = "pic.jpg"
WebClient client = new WebClient();
client.DownloadFile("http://picture.com/pic.jpg", file_name);
client.Dispose();
client = null;
pictureBox1.Image = Image.FromFile(File_Name);
pictureBox1.Image = null;
FileInfo MyFile = new FileInfo(File_Name);
MyFile.Delete();
Run Code Online (Sandbox Code Playgroud)