of software where I create SqlConnection quite often for different commands.
I'm creating it as
using (var conn = new SqlConnection(connstring))
{
}
Should I manually close the connection after the method finishes?
That's what the using statement is supposed to do so no
Yes I know that but I'm wondering if gc will kick in too slowly
Im quite sure the IL will translate this into something like try { //Ur code inside the using statement } finally { conn.Dispose(); }
I see, thank you
Обсуждают сегодня