A lambda expression can reference the local variables and parameters of the method in which it's defined. : Lambda : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » Lambda »

 

A lambda expression can reference the local variables and parameters of the method in which it's defined.








    
 


using System;
delegate int NumericSequence();

class Test {
    static void Main() {
        int seed = 0;
        NumericSequence natural = () => seed++;
        Console.WriteLine(natural());
        Console.WriteLine(natural());
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» Lambda