3
Reply

What are delegates and why are they required?

John

John

May 07, 2012
6.5k
0

    A delegate is a type that references a method. Once a delegate is assigned a method, it behaves exactly like that method. The delegate method can be used like any other method, with parameters and a return value, as in this example:public delegate int PerformCalculation(int x, int y);

    Amit Patel
    June 26, 2012
    2

    Delegate is a function pointer. We can pass method as a parameter.Public Delegate bool DelActive();Static voind main() {DelActive a= new DelActive(IsDone);IsUser(a); bool IsDone() {int x=10;if(x==10) {return true; } else {return false; } } }Class sample {Public bool IsUser(DelActive active) {if(active) { return true; } else {return false; } } }

    Pramod Verma
    January 24, 2015
    0

    Delegate is a function pointer. We can pass method as a parameter.Public Delegate bool DelActive();Static voind main() {DelActive a= new DelActive(IsDone);IsUser(a); bool IsDone() {int x=10;if(x==10) {return true; } else {return false; } } }Class sample {Public bool IsUser(DelActive active) {if(active) { return true; } else {return false; } } }

    Pramod Verma
    January 24, 2015
    0