这会using
关闭_connection
吗?
using(SqlConnection _connection = Class1.GetSqlConnection())
{ //code inside the connection
}
//connection should be closed/ended?
我只是想知道,因为GetSqlConnection()
它是一个静态函数,Class1
并且整个连接可能不会关闭,因为它正在调用外部类的静态函数而不是直接调用?
using(SqlConnection _connection = new SqlConnection(_connectionString)
{ //code inside the connection
}