An anonymous method that takes an argument. : Anonymous delegate : Delegate C# Examples


C# Examples » Delegate » Anonymous delegate »

 

An anonymous method that takes an argument.









    
using  System;    
    
delegate  void  CountIt(int  end);    
    
class  MainClass  {    
  
    public  static  void  Main()  {      
        CountIt  count  =  delegate  (int  end)  {  
                Console.WriteLine("end:"+end);  
        };  
  
        count(3);  
        count(5);    
    }  
}
    
   
  
   



Output

end:3
end:5


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Delegate
» Anonymous delegate