C#/C# 연습

C# namespace : 네임스페이스

HicKee 2022. 11. 13. 22:19

namespace

많은 클래스들을 충돌없이 보다 편리하게 관리하고 사용하기 위해 사용

 

namespace HelloCSharp
{
    class Program {
        static void Main(string[] args) {

            Console.WriteLine("Hello World!");
        }
    }
}

생략하는 경우도 있다

static void Main(string[] args) {

    System.Console.WriteLine("Hello World!");

}

.NET 6 경우 

// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

 - 아래의 최상위 문을 자동으로 생성한다

using System;

namespace MyApp // Note: actual namespace depends on the project name.
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

'C# > C# 연습' 카테고리의 다른 글

MaxValue 와 MinValue  (0) 2022.11.26
기초 연습 01  (0) 2022.11.25
C# 연산자 : Bool, 논리 연산자  (0) 2022.11.14
C# 연산자 : 문자열  (0) 2022.11.14
C# write(), WriteLine()  (0) 2022.11.13