But is it a bug?

I noticed a little "foible" of Windows when I was writing my Moosaic program. Windows provides a lovely way that you can load an image into a program. You just go:

Bitmap b = new Bitmap ( filename );

This goes off to the filename and gets you a shiny bitmap which contains your picture. However, it also leaves open the connection to the file, so that if you try to delete the file you get an error saying the file is in use. I don't think that it is. I've just read an image from it, that is all.

This is rather frustrating if you want to reuse a temporary image file. In the end I had to use a stream to read the file, which I could then properly let go of..

StreamReader streamReader = new StreamReader( filename );
Bitmap b = new Bitmap( streamReader.BaseStream );
streamReader.Close();

This is messy, but works in that the file is released. I'm wondering if I've found a bug or a feature...