Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2007

Tip: Looking for answers? Try searching our database.

Closing SafeHandle

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
valentin tihomirov - 29 Oct 2007 16:21 GMT
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-u
sing-named-pipes-in-csharp/

for one. But none of the examples closes the handle nor the 'using'
directive is used!

Should I?
Henning Krause [MVP - Exchange] - 29 Oct 2007 18:09 GMT
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

> The SafeFileHandle is an extension of SafeHandle, which requires Close()
> or Dispose() after used according to the docs. There are many examples on
[quoted text clipped - 5 lines]
>
> Should I?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.