Reputation: 1
I am working on one application which deals with images.
I have code for creating new image from byte array.
When i create some new images with same name as that of the old file names.
and tries to delete the old files
it gives me exception that file is in use, access denied.
I am not sure which process holding that image and how to release it.
Please help me..... deleting that file.
Upvotes: 0
Views: 172
Reputation: 14955
Use following code, if you are not using it the same way.
using( FileStream stream = new FileStream( path, FileMode.Open, FileAccess.Read ) )
{
image = Image.FromStream( stream );
}
Posting your own code, would help though!
Upvotes: 2