An anonymous method. : Anonymous delegate : Delegate C# Examples


C# Examples » Delegate » Anonymous delegate »

 

An anonymous method.









    
using  System;    
    
delegate  void  Do();    
    
class  AnonMethDemo  {    
  
    public  static  void  Main()  {      
          Do  count  =  delegate  {    
            for(int  i=0;  i  <=  5;  i++)    
                Console.WriteLine(i);  
        };  
  
        count();    
    }  
}
    
   
  
   



Output

0
1
2
3
4
5


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Delegate
» Anonymous delegate