Chapter 20LINQ Code Downloads for this Chapter

You can find the code downloads for this chapter at on the Download Code tab. The code is in the Chapter 20 download and individually named according to the names throughout the chapter.

This chapter introduces Language INtegrated Query (LINQ). LINQ is an extension to the C# language that integrates data query directly into the programming language itself.

Before LINQ this sort of work required writing a lot of looping code, and additional processing such as sorting or grouping the found objects required even more code that would differ depending on the data source. LINQ provides a portable, consistent way of querying, sorting, and grouping many different kinds of data (XML, JSON, SQL databases, collections of objects, web services, corporate directories, and more).

First you'll build on the previous chapter by learning the additional capabilities that the system.xml.linq namespace adds for creating XML. Then you'll get into the heart of LINQ by using query syntax, method syntax, lambda expressions, sorting, grouping, and joining related results.

LINQ is large enough that complete coverage of all its facilities and methods is beyond ...

Get Beginning C# 6.0 Programming with Visual Studio 2015 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.