[C#] 이벤트 핸들러

c# 2023. 1. 11. 11:53
728x90
static public void HandlerTest(string testMsg)
{
    Console.WriteLine(testMsg);
}

static void Main(string[] args)
{
    Ch_28 ch = new Ch_28();
    ch.EV += new EventHandler(HandlerTest);
    ch.eventTest("2222222");

}
delegate void EventHandler(string msg);
class Ch_28
{
	public event EventHandler EV;
    public void eventTest(string eventMsg)
    {
    	EV("이벤트 메세지 : " + eventMsg);
    }
}
728x90

'c#' 카테고리의 다른 글

[C#] 람다식  (0) 2023.01.11
[C#] Stack, Queue, Hashtable  (0) 2023.01.11
[C#] Delegate  (0) 2023.01.10
[C#] 추상클래스  (0) 2023.01.10
[Unity] 기본 정리 (문서화)  (0) 2023.01.09
Posted by 바르마스
,