CSharp:using
C#의 using
문법에 대한 내용.
지시문 (Directive) using
다른 네임스페이스에 정의된 타입을 Import 하거나, 네임스페이스에 대한 별칭을 만들때 사용한다.
문장 (Statement) using
개체의 범위를 정의할때 사용한다. 그 범위를 벗어나면 자동으로 Dispose 된다.
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
command.Connection.Open();
command.ExecuteNonQuery();
}