Chapter 23
Introduction to LINQ
What You Will Learn in this Chapter
- Coding a LINQ query and the parts of a LINQ query statement
- Using LINQ method syntax versus LINQ query syntax
- Ordering query results, including ordering on multiple levels
- When and how to use LINQ aggregate operators
- Using projection to create new objects in queries
- Using the Distinct(), Any(), All(), First(), FirstOrDefault(), Take(), and Skip() operators
- Grouping queries
- Setting operators and joins
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
You can find the wrox.com code downloads for this chapter at www.wrox.com/remtitle.cgi?isbn=9781118314418 on the Download Code tab. The code is in the Chapter 23 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. LINQ solves the problem of dealing with very large collections of data.
In the past, 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, sometimes mixing in a different query language such as SQL (Structured Query Language) typically found in relational databases. LINQ frees you from having to write this extra looping code to filter and sort. It enables you to focus on the objects that matter to your program.
In addition to providing an elegant query language that enables ...
Get Beginning Visual C# 2012 Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.