Home All Groups Group Topic Archive Search About
Author
29 Oct 2007 3:21 PM
valentin tihomirov
The SafeFileHandle is an extension of SafeHandle, which requires Close() or
Dispose() after used according to the docs. There are many examples on using
the named pipes in .Net. All the examples expoit
FileStream(CreateFile(PIPE_NAME)). You may look at
http://blog.paranoidferret.com/index.php/2007/07/25/interprocess-communication-using-named-pipes-in-csharp/
for one. But none of the examples closes the handle nor the 'using'
directive is used!

Should I?

Author
29 Oct 2007 5:09 PM
Henning Krause [MVP - Exchange]
Hello,

the SafeHandle will eventually disposed by its destructor. But calling the
Dispose method when you no longer need the SafeHandle is a very good idea -
it deterministically releases the unmanged handle and removes the instance
from the finalization queue which tracks all instances with a finalizer.

Kind regards,
Henning Krause

Show quote
"valentin tihomirov" <V_tihomi***@best.ee> wrote in message
news:%23DlSp8jGIHA.5328@TK2MSFTNGP05.phx.gbl...
> The SafeFileHandle is an extension of SafeHandle, which requires Close()
> or Dispose() after used according to the docs. There are many examples on
> using the named pipes in .Net. All the examples expoit
> FileStream(CreateFile(PIPE_NAME)). You may look at
> http://blog.paranoidferret.com/index.php/2007/07/25/interprocess-communication-using-named-pipes-in-csharp/
> for one. But none of the examples closes the handle nor the 'using'
> directive is used!
>
> Should I?
>

AddThis Social Bookmark Button