In this chapter
Understanding the language extensions
Using lambda expressions
Working with the
Considering object initializers
Considering collection initializers
Using extension methods
Using partial methods
Understanding expression trees
Defining query extensions
LINQ doesn't appear as part of older versions of Visual Studio. Yes, you can use LINQ in these older versions, but you must use special techniques to do it — not much is automatic (see Chapter 5 for details). Part of the reason that LINQ works the way it does is the addition of language extensions to .NET Framework. The language extensions make it possible for .NET Framework to support LINQ and for you to create queries of various types.
This chapter provides an overview of the major .NET language extensions from the C# developer's perspective. Chapter 4 provides information about the differences between C# and Visual Basic .NET from the Visual Basic .NET developer's perspective. Although the two languages do support the same basic features, you'll find that Visual Basic .NET provides some additional automation that C# doesn't and C# provides flexibility that Visual Basic .NET doesn't. Either language will perform all basic queries and most complex queries without any problem.
The chapter begins with an overview of the extensions in .NET Framework 3.5. The sections that follow provide additional details on each of these extensions. In many ...