https://learn.microsoft.com/ko-kr/dotnet/csharp/how-to/concatenate-multiple-strings#code-try-2


var 형 
visual C# 3.0부터 메소드 범위에서 선언된 변수에 암시적 형식 var을 사용할 수 있습니다. 
var형식은 지역변수로만 사용할 수 있습니다. 암시적 형식 지역 변수는 형식을 직접 선언한 것처럼
강력한 형식이지만 컴파이러가 형식을 결정합니다. i의 다음 두서언으 기능이 동일합니다. 

var i = 10; //암시적 형식 
int i = 10; //명시적 형식 

백슬래시(\)뒤에 한 문자나 숫자가 오는 문자 조합을 "이스케이프 시퀸스"라고 합니다. 줄
바꿈 문자('\n'), 따옴표('\''), 탭('\t')또는 문자 상수의 다른 특정 문자를 나타내려면 이스
케이프 시퀸스를 사용해야 합니다. 이스케이프 시퀸스는 단일 문자로 간주됩니다. 콘솔에 
백슬래시(\)를 출력하고 싶다면 백슬래시 두 개(\\)를 써야 합니다. 왜냐하면 첫 번째 백슬
래시는 이스케이프 시퀸스의 시작을 알리는 용도이기 때문에 두 개를 써야 백슬시 하나를 
출력합니다. 

겹 따옴표(")앞에 @를 쓰면 이스케이프 시퀸스를 무시합니다. 
string b = @"c:\Docs\Source\a.txt"; // "c:\Docs\\Source\\a.txt"와 동일

x = 1; 이라는 문장이 있습니다. 이문장의 뜻은 "1이라는 값을 x라는 곳에 넣어라"라는 뜻입니다.

여기서 값과 곳이라는 말이 중요합나디. '='표시의 오른쪽은 값, 왼쪽은 곳을 의미합니다. 즉 '='
표시의 오른쪽을 rhs(right hand side) value, 왼쪽을 lhs(left hand side) identifier(식별자)
라고 합니다. 중요한 것은 rhs는 변수, 값, 수식 등이 올 수 있지만 lhs는 변수만이 올 수 있다는 
것입니다. 

 

$ 문자열 연결, 문자열 보간 

string userName = "<kim>";
int age = 32;
string date = DateTime.Today.ToShortDateString();

// Use string interpolation to concatenate strings.
//일부 식에서는 다음 코드와 같이 문자열 보간을 사용하여 문자열을 연결하는 것이 더 쉽다.
string str = $"Hello {userName}. Today is {date} Age {age}.";
System.Console.WriteLine(str);

 

C# 프로그래밍 구조 

 

class Hello 
{
    static void Main()
    {
        System.Console.WriteLine("hello, world");
    }

}

class Hello 

{

    static void Main()
    {
    }
}

 

C# 콘솔에서 컴파일 



G:\temp_source\cshapExam\hello>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe hello.cs
Microsoft (R) Visual C# Compiler version 4.8.4084.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, 

which is no longer the latest version. For compilers that support newer versions of the C# programming language, 

see http://go.microsoft.com/fwlink/?LinkID=533240

 

C# 콘솔에서 컴파일

G:\temp_source\cshapExam\hello>hello
hello, world

G:\temp_source\cshapExam\hello>type hello.cs
class Hello
{
    static void Main()
    {
        System.Console.WriteLine("hello, world");
    }

}
namespace A011_FormatSpecifier
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("{0:N2}", 1234.5678);
            Console.WriteLine("{0:D8}", 1234);
            Console.WriteLine("{0:F3}", 1234);
            Console.WriteLine("{0,8}", 1234);
            Console.WriteLine("{0,-8}", 1234);

            string s;
            s = string.Format("{0:N2}", 1234.5678);
            Console.WriteLine(s);
            s = string.Format("{0:D8}", 1234);
            Console.WriteLine(s);
            s = string.Format("{0:F3}", 1234.56);
            Console.WriteLine(s);

            Console.WriteLine(1234.5678.ToString("N2"));
            Console.WriteLine(1234.ToString("D8"));
            Console.WriteLine(1234.56.ToString("F3"));

            Console.WriteLine("{0:#.##}", 1234.5678);
            Console.WriteLine("{0:0,0.00}", 1234.5678);
            Console.WriteLine("{0:#,#.##}", 1234.5678);
            Console.WriteLine("{0:000000.00}", 1234.5678);

            Console.WriteLine("{0:#,#.##;(#,#.##);zero}", 1234.567);
            Console.WriteLine("{0:#,#.##;(#,#.##);zero}", -1234.567);
            Console.WriteLine("{0:#,#.##;(#,#.##);zero}", 0);
            
            string b = @"c:\Docs\Source\a.txt";
            Console.WriteLine(b);

        }
    }
}​
G:\temp_source\cshapExam\hello>hello
hello, world

G:\temp_source\cshapExam\hello>type hello.cs
class Hello
{
    static void Main()
    {
        System.Console.WriteLine("hello, world");
    }

}
G:\temp_source\cshapExam\hello>hello
hello, world

G:\temp_source\cshapExam\hello>type hello.cs
class Hello
{
    static void Main()
    {
        System.Console.WriteLine("hello, world");
    }

}

 

,


-->