Why does the Dispose method not call the Close method?

Oct 31, 2009 at 12:43 PM

see discussion title

this way we could us it this way:

 

using(var ftp = new FtpConnection())
{
   // do some ftp stuff

Coordinator
Nov 1, 2009 at 2:17 PM

I noticed that after I uploaded the project. The next time I commit, the Dispose method will check if _hInternet and _hConnect are IntPtr.Zero and if not, call InternetCloseHandle for each.

public void Dispose()
{
  if(_hConnect != IntPtr.Zero)
  {
     WININET.InternetCloseHandle(_hConnect);
  }

  if(_hInternet != IntPtr.Zero)
  {
     WININET.InternetCloseHandle(_hInternet);
  }
}