.NET Framework4.7.2
[C#] 가이드 1/19 .. 6/19
무한경쟁시대
2022. 3. 7. 09:09
.NET은 마이크로소프트에서 개발한 윈도우 개발 및 실행환경입니다.
.NET Framework와 .NET Core는 .NET 5.0으로 통합되었으나
아직까지 .NET Framework와 .NET Core를 많이 사용 중입니다.
.NET 개발 환경에서 C# 언어를 사용하게되고, C# 기본사용법을 알아보겠습니다.
https://docs.microsoft.com/ko-kr/dotnet/csharp/tour-of-csharp/tutorials/hello-world?tutorial-step=1
Hello World - C# 소개 대화형 C# 자습서
이 자습서에서는 브라우저를 사용하여 C#을 대화형으로 학습할 수 있습니다. C# 코드를 작성하고 브라우저에서 직접 코드를 컴파일하고 실행한 결과를 확인할 수 있습니다.
docs.microsoft.com
https://github.com/cutetory/CsharpGuide.git
GitHub - cutetory/CsharpGuide
Contribute to cutetory/CsharpGuide development by creating an account on GitHub.
github.com
//사용 할 변수들
string aFriend = "Maria";
string firstFriend = "Mason";
string secondFriend = "Sage";
string greeting = " Hello World! ";
string trimmedGreeting = greeting;
string songLyrics = "You say goodbye, and I say hello";
var result = songLyrics.Contains("goodbye");
//method(함수) 만들어보기
string fun(string temp1, string temp2){
string temp3 = temp1 + temp2;
return temp3;
}
Console.WriteLine("Hello " + aFriend);
// +로 합치는 것보다 $(문자열보간/String interpolation)을 권장합니다.
Console.WriteLine($"Hello {aFriend}");
Console.WriteLine($"My friends are {firstFriend} and {secondFriend}");
Console.WriteLine($"The name {firstFriend} has {firstFriend.Length} letters");
Console.WriteLine($"띄어쓰기 전:[{greeting}]");
trimmedGreeting = greeting.Trim();
Console.WriteLine($"띄어쓰기 후:[{trimmedGreeting}]");
string replaceTest = fun("test"," success");
replaceTest = replaceTest.Replace("test","Programming");
Console.WriteLine(replaceTest);
Console.WriteLine(result);
Console.WriteLine(songLyrics.StartsWith("You"));
Console.WriteLine(songLyrics.StartsWith("goodbye"));
Console.WriteLine(songLyrics.EndsWith("hello"));
Console.WriteLine(songLyrics.EndsWith("goodbye"));
int a = 7;
int b = 4;
int c = 3;
int d = (a + b) / c;
int e = (a + b) % c;
Console.WriteLine($"quotient: {d}");
Console.WriteLine($"remainder: {e}");
//오버플로우
int what = max + 3;
Console.WriteLine($"An example of overflow: {what}");