John
What are delegates and why are they required?
By John in C# on May 07 2012
  • Amit Patel
    Jun, 2012 26

    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);

    • 2
  • Pramod Verma
    Jan, 2015 24

    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; } } }

    • 0
  • Pramod Verma
    Jan, 2015 24

    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; } } }

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS