using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloWorld
{
class App
{
//생성자
public App()
{
Button btn = new Button();
btn.onClick = () =>
{
Console.WriteLine("click!");
};
btn.Click();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloWorld
{
class Button
{
public Action onClick;
//생성자
public Button()
{
}
public void Click()
{
this.onClick();
}
}
}
'C# > 수업 내용' 카테고리의 다른 글
파일 읽기, 역직렬화 연습 (0) | 2021.12.24 |
---|---|
람다식 연습 15 (Comparision) (0) | 2021.12.24 |
람다식 연습 7 (Func) - 피자 (0) | 2021.12.24 |
람다식 연습 6 (Func) 난수생성 (0) | 2021.12.24 |
람다식 연습 5 (Func) 두 수 더하기 (0) | 2021.12.24 |