Hi
Can anyone tell me How to Implement delegates in out .Net application
Can you please give me sample example
Printable View
Hi
Can anyone tell me How to Implement delegates in out .Net application
Can you please give me sample example
Delegate is nothing but a function pointer in c++. Microsoft implemented deleagtes in events and threads.
Events: Event source doesn't know who will handle the event and event handler doesn't know who raised the event the delegate is act like a interface between event source and event handler here event handler signature and delegate signature is same and event type is delegate type.
namespace n1{
class class1{
public void delegate d1();
public event d1 e1;
public void Event_Handler()
{
//code
}
public static void main(){
//bind the event to event handler using delegete
this.e1 +=new d1(this.Event_Handler);
e1();
}
}
}