First I would implement IDisposable.
Next I would either
A: Create a stream class that writes &EXIT. It is the stream that owns the
unmanaged resource.
or
B: Throw an exception if you collect an instance that has not been closed.
FileStream for example will flush the contents if the handle is still
available, otherwise your file will just be missing some data. The idea is
that soon enough you will realise your data is missing and fix your bug.
I'd be more inclined to go for option B!
--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com