A lambda expression has the following BNF form: (parameters) => expression-or-statement-block

image_pdfimage_print
   
 

using System;

class Test {
    static void Main() {
        Func<int, int> square = x => x * x;
        Console.WriteLine(square(3));     // 9
    }
}

    


This entry was posted in LINQ. Bookmark the permalink.