Which one of the following two methods has better performance ?
using( var DB_Connection_s = new DBConnection() )
{
//todo: interact with database connection
}
or just :
DB_Connection_s.Close();
at the end.
Does the first method make the pooling concept useless? Because if I dispose the connection with each use, then I have to open a new connection every time (and there won’t be any connections in the pool).
source = SQL Server Connection Pooling (ADO.NET)
So, remove any worry about performance loss caused by missed pooled connections.
From the code standpoint the difference should be so minimal that the
usingstatement should always be used