아래는 책의 나온 내용 입니다~ ㅎㅎ
좋은 예제 인거 같아서 올려 봅니다. 참고하세요.

"익명메서드는 코드를 정의하기는 하지만 일종의 값으로 분류되므로 델리게이트 객체에 대입할 때 제일 끝의 세미콜론을 빼먹지 않도록 주의해야 한다."

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Server;

namespace Client
{
    delegate int dele(int a, int b);

    class Program
    {
        static void Main(string[] args)
        {
            dele d = delegate(int a, int b) { return a + b; };
            int k = d(2, 3);
            Console.WriteLine(k);
        }
    }
}

'객체지향언어 > C#' 카테고리의 다른 글

listview를 이용해 보자  (0) 2009.08.11
델리게이트 - 참조  (0) 2009.08.10
DllImport 어트리뷰트 사용 예제.  (0) 2009.08.10
배틀넷 아뒤와 방제를 가지고 온다.  (0) 2009.08.09
FileWatcher 예제  (0) 2009.08.09

+ Recent posts