Skip to content
Search

CSharp:using

lastmod 2021-01-19created 2021-01-192 edits

Notes on the using syntax of C#.

using Directive

Used to Import types defined in another namespace, or to create an alias for a namespace.

using System.Text; //코드 상단에 네임스페이스 정의
using Project = PC.MyCompany.Project; // 별칭

using Statement

Used to define the scope of an object. Once it goes out of that scope, it is Disposed automatically.

using (SqlConnection connection = new SqlConnection(connectionString))
{
    SqlCommand command = new SqlCommand(queryString, connection);
    command.Connection.Open();
    command.ExecuteNonQuery();
}

See also

author Zer0 sitemap