Chapter 2. C# and VB.NET language enhancements
This chapter covers:
- Key C# 3.0 and VB.NET 9.0 languages features for LINQ
- Implicitly typed local variables
- Object initializers
- Lambda expressions
- Extension methods
- Anonymous types
In chapter 1, we reviewed the motivation behind LINQ and introduced some code to give you an idea of what to expect. In this chapter, we’ll present the language extensions that make LINQ possible and allow queries to blend into programming languages.
LINQ extends C# and VB.NET with new constructs. We find it important that you discover these language features before we get back to LINQ content. This chapter is a stepping stone that explains how the C# and VB.NET languages have been enriched to make LINQ possible. Please note that the full-fledged features we present here can be used in contexts other than just LINQ.
We won’t go into advanced details about each feature, because we don’t want to lose our focus on LINQ for too long. You’ll be able to see all these features in action throughout this book, so you should grow accustomed to them as you read.
In chapter 3, we’ll focus on LINQ-specific concepts such as expression trees and query operators. You’ll then see how the features presented in this chapter are used by LINQ.