Chapter 2. Creating Simple LINQ Queries
In This Chapter
Working with the LINQ keywords
Creating a simple query using the
wherekeyword to filter the query
orderbykeyword to group the query output
Defining and using multiple query sources
Using the standard query operators
Using methods in a query
LINQ is amazing in one respect: few keywords are associated with it. In fact, LINQ is quite terse for the tasks it performs. A keyword is a special word that tells LINQ the parameters of the query, such as which data source to use. The focus of this chapter is to acquaint you with the standard keywords, those that you'll use most often to create queries. In fact, the keywords found in this chapter may be all that you have in some LINQ to scenarios. Nothing stops a provider vendor from adding other keywords, but if you know the few found in this chapter, you'll have a considerable head start on using LINQ to perform most basic tasks.
Beside keywords, LINQ also uses an amazing array of operators. An operator is a special word that tells LINQ what kind of query to perform, such as checking whether two values are equal. Unlike keywords, operators can run into the hundreds. In most cases, you'll perform the majority of tasks using only a few standard operators. Most other operators provide special functionality that you may never need. This chapter reviews the standard operators available to all LINQ to providers. You'll find other operators discussed in chapters that ...