Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 15,860 times

Contents

Related Categories

Exploring Delegates - Introduction

Introduction

Delegates are a kind of type safe function pointers which are actually declared as class derived from System.MulticastDelegate. There are few rules how to write that class. First you must declare .ctor and Invoke methods, if you like to have asynchronous callback involved there are two more methods just for that case BeginInvoke and EndInvoke. Except for these two or four methods nothing else should be declared and these declarations must be without implementation (empty body). This is what it looks like:

    .method public hidebysig specialname rtspecialname 
    instance void .ctor(object 'object',
    native int 'method') runtime managed
    {
    } // end of method WildCard::.ctor

    .method public hidebysig virtual instance int32 
    Invoke() runtime managed
    {
    } // end of method WildCard::Invoke 

Comments