Table adapters dispose themselves?

  • Thread starter Thread starter dgk
  • Start date Start date
D

dgk

Should I dispose of table adapters and data tables and rows or do they
garbage collect themselves?
 
dgk said:
Do they implement IDisposable? e.g, do they have a Dispose method?
If so, you may call it. Otherwise, not to worry, the garbage man will get
around to it.
-- Peter

Is that how you tell whether to dispose of something, it has a dispose
method? I know for graphic objects you have to dispose them, and most
objects you don't have to.

Data connections normally have to be disposed of, and the table
adapter is pretty much a data adapter with a built-in connection
object (with some queries along for the ride).

I guess it's safer to just call Dispose on them.
 
in general objects only implement IDispose if they need it, though many
have a alternate method like Close()

-- bruce (sqlwork.com)
 
in general objects only implement IDispose if they need it, though many
have a alternate method like Close()

-- bruce (sqlwork.com)

Thanks. I guess if it has dispose, I''l call it. I don't think there's
a downside.
 
Back
Top