c# 멀티캐스트 대리자 샘플

Published Aug 26, 2010 | Updated Sep 22, 2022 | 0 comments

delegate void Del(string s);

class TestClass {
    static void Hello(string s) {
        Console.WriteLine("  Hello, {0}!", s);
    }

    static void Goodbye(string s) {
        Console.WriteLine("  Goodbye, {0}!", s);
    }

    public static void Test() {
        Del a, b, c, d;

        // Create the delegate object a that references 
        // the method Hello:
        a = Hello;

        // Create the delegate object b that references 
        // the method Goodbye:
        b = Goodbye;

        // The two delegates, a and b, are composed to form c: 
        c = a + b;

        // Remove a from the composed delegate, leaving d, 
        // which calls only the method Goodbye:
        d = c - a;

        Console.WriteLine("Invoking delegate a:");
        a("A");

        Console.WriteLine("Invoking delegate b:");
        b("B");

        // A, B 둘다 호출됨
        Console.WriteLine("Invoking delegate c:");
        c("C");

        // A, B 에서 A 가 빠진 B 만 호출됨
        Console.WriteLine("Invoking delegate d:");
        d("D");
    }
}

Output

Invoking delegate a:
  Hello, A!
Invoking delegate b:
  Goodbye, B!
Invoking delegate c:
  Hello, C!
  Goodbye, C!
Invoking delegate d:
  Goodbye, D!

TAG INFORMATION

Learn more on this topic

Related Blog Posts

DevExpress XtraGrid 의 특정 Row Handle 과 Grid DataSource 의 Index

XPO 와 Grid 를 연동해서 작업을 하던중 알아낸 차이점 Grid 의 선택된 RowHandle 받기 - gridView2.GetSelectedRows() 실제 Grid 의 선택된 Row 의 실제 데이터소스의 Index 받아오기 - gridView2.GetDataSourceRowIndex(gridView2.GetSelectedRows()[0]) 2008-09-02 추가 그리고.. 추가로 위의 소스로 데이터를 한개의 Row 씩 순차적으로 삭제할때(Grid, DataSource...

read more
ClickOnce 업데이트 서버 구성 방법 정리

ClickOnce 업데이트 서버 구성 방법 정리

1. IIS 설치 후 FrontPage Server Extensions 2002 구성 구성이 되면 아래와 같이 별도 탭이 생성됨 2. IIS 셋팅 - 인증 3. IIS 셋팅 - HTTP 헤더 설정 콘텐츠 만료 지정 하고 즉시 만료로 하면 업데이트시 캐쉬를 신경쓰지 않아도 됨 사용자 지정 HTTP 헤더 확인 – 없으면 추가 4. IIS 셋팅 - ASP.NET 설정 현재 개발 프레임웍에 맞게끔 설정이 되어있는지 확인 MIME 형식 연결 MIME 설정은...

read more

Join in the conversation

Leave a Comment

0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

무료 온라인 전광판

전광판

텍스트를 입력하고 텍스트 효과 및 배경효과 를 변경해서 전체화면으로 표시할 수 있는 전광판 용도로 사용하실 수 있습니다. 각종 스포츠 및 공연 관람시 응원 용도로 사용이 가능합니다.

Carousel

여러개의 슬라이드를 추가하여 프레젠테이션 및 이미지 슬라이드 용도로 사용하실 수 있습니다. 브라우저가 포함된 IT 기기로 큰 모니터에 연결하여 매장 내 공지사항 및 메뉴소개를 이미지로 표시할 수 있습니다.

Pin It on Pinterest

Shares
Share This

Share This

Share this post with your friends!

Shares