I have the following code:
Bitmap image = new Bitmap(filePath);
...
image.Save(someOtherPath);
image.Dispose();
File.Delete(filePath);
File.Move(someOtherPath, filePath);
The File.Delete line raises the following error:
The process cannot access the file '...' because it is being used by another process.
How do I get the C# to release the lock it has on the file?
Try