Introduction
.
기호는 네임스페이스 및 형식 멤버에 액세스할 때 사용한다.
Using 지시문
- using 지시문을 사용할 때
.
을 사용하여 중첩된 네임스페이스 또는 형식에 접근할 수 있다.
using System.ComponentModel;
using static System.Console;
정규화된 형식
.
을 사용하여 정규화된 이름
을 만들고 네임스페이스 내의 형식에 액세스할 수 있다.
using 지시문
을 사용하면 정규화를 하지 않아도 된다.
System.Collections.Generic.List<int> ints = [1, 2, 3, 4, 5];
System.Console.WriteLine(string.Join(", ", ints));
/* output:
1, 2, 3, 4, 5
*/
멤버 접근
.
을 사용하여 형식의 정적, 비정적 멤버에 접근할 수 있다.
string foo = "ABC";
Console.WriteLine(foo.Length);
/* output:
3
*/
확장 메서드
public static class IntExtension
{
public static int Add(this int A, int B) => A + B;
}
int foo = 1;
int bar = 2;
Console.WriteLine(foo.Add(bar));
/* output:
3
*/
참조 자료