以下是等价的吗?在某些情况下
使用类型很重要吗?var
目前使用这个:
static int ReturnIDfromDb(string sqlString, string outputParam) {
var connectionString = ConfigurationManager.ConnectionStrings["xxx"].ConnectionString;
using(var conn = new SqlConnection(connectionString))
using(var comm = new SqlCommand(sqlString, conn)) {
...
}
}
这不是更具体吗?
static int ReturnIDfromDb(string sqlString, string outputParam) {
var connectionString = ConfigurationManager.ConnectionStrings["xxx"].ConnectionString;
using(SqlConnection conn = new SqlConnection(connectionString))
using(SqlCommand comm = new SqlCommand(sqlString, conn)) {
...
}
}