Are there IDbCommand, IDataReader, or DataTable resources if Dispose is not called?

When using IDbCommand, IDataReader, or DataTable, can you depend on the destructor for the disposal of resources or will these objects leak resources if dispose is not called directly?

+4
source share
1 answer

They do not leak, but they will consume resources until garbage is collected. GC will call Dispose () on them. I don’t think DataTable supports connecting to the database, so you don’t have to worry about calling Dispose () or Close () on it.

See my answer here for a similar question.

+4
source

All Articles