When using IDbCommand, IDataReader, or DataTable, can you depend on the destructor to dispose resources, or will these objects leak resources if dispose is not called directly?
Asked
Active
Viewed 986 times
1 Answers
4
They don't leak, but they will consume resources until they are garbage collected. The GC will call Dispose() on them. I don't think DataTable maintains a connection to the database, so you wouldn't have to worry about calling Dispose() or Close() on it.
See my answer here to a similar question.