About This eBook by Bart De Smet

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Lambda Expressions

With the advent of LINQ in C# 3.0 the use of functions as arguments to higher-order query operator functions was to become a day-to-day activity for developers, having to write query expressions like the following:

int[] numbers = new [] { 1, 2, 3, 4, 5 };var evens = numbers.Where(delegate (int i) { return i % 2 == 0; });var odds  = numbers.Where(delegate (int i) { return i % 2 != 0; });

You will agree that the preceding code is still quite overloaded with syntactical noise that comes from the use of anonymous function expressions: delegate and return keywords, and curly braces.

Note: Concise syntax matters

Simplified query expression syntax exists in C# 3.0, reducing the need to deal with the ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required