return 값이 없는 Delegate
0 ~ 16개의 파라미터 까지 받을 수 있게 미리 만들어져 있다.
class AClass
{
public void Run()
{
// 기존 메서드 지정
System.Action<string> act = Output;
act("Hello");
// 무명 메서드 지정
Action<string, string> act2 = delegate(string msg, string title)
{
MessageBox.Show(msg, title);
};
act2("No data found", "Error");
// 람다식 사용
Action<int> act3 = code => Console.WriteLine($"Code : {code}");
act3(1033)
}
}
return 값이 있는 Delegate
0 ~ 16개의 파라미터 까지 받을 수 있게 미리 만들어져 있다.
return 값이 반드시 bool값이여야하는 Delegate
LINQ등을 지원 할 수 있게 만들어졌다.