Anonymous delegate method : Anonymous delegate : Delegate C# Examples


C# Examples » Delegate » Anonymous delegate »

 

Anonymous delegate method









    
using  System;

class  MainClass
{
      delegate  int  FunctionToCall(int  InParam);

      static  void  Main()
      {
            FunctionToCall  del  =  delegate(int  x){
                                                return  x  +  20;
                                          };
            Console.WriteLine("{0}",  del(5));
            Console.WriteLine("{0}",  del(6));
      }
}
    
   
  
   



Output

25
26


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Delegate
» Anonymous delegate