I'm running the following code and I'm unsure whether the adapter (and the instance of SqlCommand, which I suspect resides in it) gets properly GCed. Also, I'm a bit unsure how to check it, other than asking on SO.
using (SqlConnection connection = new SqlConnection(...))
{
String command = ...
DataTable output = new DataTable();
SqlDataAdapter adapter = new SqlDataAdapter(command, connection);
adapter.Fill(parameters);
}
I'm assuming that closing the connection isn't necessary as it gets killed and destroyed when the scope of its declaration ends. Is that correct or am I missing something sneaky?