Table adapters dispose themselves?

D

dgk

Should I dispose of table adapters and data tables and rows or do they
garbage collect themselves?
 
D

dgk

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.
 
B

bruce barker

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

-- bruce (sqlwork.com)
 
D

dgk

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top