The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Close() or Dispose()...

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Paschal

Posts: 1621
Nickname: bigapple
Registered: Nov, 2003

Paschal is a .Net developer
Close() or Dispose()... Posted: Feb 5, 2004 10:40 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Paschal.
Original Post: Close() or Dispose()...
Feed Title: help.net
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/pleloup/Rss.aspx
Feed Description: .Net for mankind !
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Paschal
Latest Posts From help.net

Advertisement

Interesting post from Jim Blizzard.Still the debate continue but yes agree MSDN docs are the reference.

 

 

Rory asks us (http://neopoleon.com/blog/posts/2889.aspx)

about calling Close() or Dispose() on ADO.NET objects.  He went into ILDASM to see if Dispose() also calls Close(), and sure enough, it does.

 

And all he had to do was look in the MSDN docs.  Cause we know that the MSDN docs are always right, don't we.  ;)

 

public void SqlConnectionHereAndGone()

{

SqlConnection myConnection = new

SqlConnection("Initial Catalog=Northwind;Data Source=localhost;Integrated Security=SSPI;");

myConnection.Open();

//Calling Dispose also calls SqlConnection.Close.

myConnection.Dispose();

}

 

Look at that comment in the sample code (straight from MSDN):  "Calling Dispose also calls SqlConnection.Close."

 

Amazing.  :)

 

 

Read: Close() or Dispose()...

Topic: Custom Exception Types from a Managed COM+ (ES) Server Application Previous Topic   Next Topic Topic: .NET Nightly 103

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use