Favicon

Invocation expression

Peponi12/26/20241m

C#
SyntaxExpression()

1. Introduction

다음 멤버는 괄호 ()를 사용하여 호출할 수 있다.

2. Example

Constructor
var foo = new List<int>();
Method
Console.WriteLine("Hello, World!");
Delegate
delegate void ConsoleWriter(string message);
 
static void Main(string[] args)
{
    ConsoleWriter writer = new(Write);
 
    writer("Hello, World!");
}
 
static void Write(string message) => Console.WriteLine(message);

3. 참조 자료