VB.NET Lambda Expressions

If I have Visual Studio 2008 and am targeting a .NET 2.0 application, can I use Lambda expressions? My understanding of Lambda expressions is that its function is built into the compiler, not the framework, so I would conclude that I can use Lambda in a .NET 2.0 application. Can someone please tell me if so?

+5
source share
3 answers

Yes, it is fully supported. Until you create an expression tree or refer to System.Core, System.Xml.Linq, etc., it is completely legal to use lambda expressions in an application with a specific purpose of 2.0. This applies to any other compiler function introduced in VS2008 (VB9).

EDIT

Several answers incorrectly state that Lambda Expressions is a 3.5 or 3.0 feature. Lambda expressions are a compiler function, not a Framework. They don’t need the support of the framework to work, and it’s quite legal to use them in an application down aimed at 2.0.

, , - . - , , 3.5. , , .

+12

, . -. . :

int sum = 0;
Array.ForEach(new[] {1, 2, 3, 4}, x => sum += x);

, , .Net 3.5 ( Linq). System.Linq, System.Core .., .Net 2.0.

+2

. Linq , System.Linq , .NET 2.0 .

-3

All Articles