C#/수업내용

대리자, 람다식, 익명함수 이해

띵킹진 2022. 6. 16. 17:58
using System;
using System.Collections;

namespace Study06
{
    
    public class App
    {

        public App()
        {
            Hero hero = new Hero();

            hero.Move(() => {
                Console.WriteLine("move complete!");
            });
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Study06
{
    public class Hero
    {
        public Hero()
        {
            
        }
        public void Move(Action callback)
        {
            //이동코드 블라블라
            callback();
        }
    }
}