O'Reilly logo

LINQ For Dummies® by John Paul Mueller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Creating Simple LINQ Queries

In This Chapter

  • Working with the LINQ keywords

  • Creating a simple query using the from keyword

  • Using the where keyword to filter the query

  • Using the orderby keyword 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required