Rylah's Study & Daily Life
[C#/VS2022].Net Core 6.0부터 변경된 Console 본문
최근 VS 2022로 C# Console을 생성하면 이렇게 보인다.
1
2
|
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
|
cs |
기존의 using, namespace, class, Main을 숨겨놨다.
Top Level Statement를 바로 접근한다는 의미이다.
기존 처럼 사용하려면
https://docs.microsoft.com/nl-nl/dotnet/core/tutorials/top-level-templates
C# console app template changes in .NET 6 - .NET
The .NET 6 project template for C# console apps uses top-level statements. Understand what's changed and how to use existing learning materials with the new syntax.
docs.microsoft.com
http://www.csharpstudy.com/Latest/CS10-VS2022.aspx
VS 2022 설치 - C# 프로그래밍 배우기 (Learn C# Programming)
C# 10: VS 2022와 .NET 6 설치 C# 10을 사용하기 위해서는 Visual Studio 2022와 .NET 6를 설치하여야 한다. (참고: VS Code에서도 C# 10을 사용할 수 있다) VS 2022는 https://visualstudio.microsoft.com/launch 에서 Community 2022
www.csharpstudy.com
를 참고로 할 수 있는데 .. 기존의 책들은 예전 C# 버전을 기반으로 서술되어 코드가 달라서 당황할 수 있다.
이 코드를 복붙하면 된다. 처음 링크에 가면 그대로 있다.
1
2
3
4
5
6
7
8
9
10
11
12
|
using System;
namespace MyApp // Note: actual namespace depends on the project name.
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
|
cs |
'Study > C#' 카테고리의 다른 글
c# (0) | 2022.03.28 |
---|---|
[C#/Study] 05. Enum (0) | 2022.02.27 |
[C#/Study] 04. Operator (0) | 2022.02.27 |
[C#/Study] 03. Method (0) | 2022.02.27 |
[C#/Study] 02. DataType / Overflow (0) | 2022.02.26 |