LINQ in Action
Fabrice Marguerie, Steve Eichert and Jim Wooley
  • January 2008
  • ISBN 9781933988160
  • 576 pages
  • printed in black & white

It's like they threw a party for LINQ and everyone who's anyone showed up.

From the Foreword by Matt Warren, Principal Architect, Microsoft

LINQ in Action is a fast-paced, comprehensive tutorial for professional developers who want to use LINQ. This book explores what can be done with LINQ, shows you how it works in an application, and addresses the emerging best practices. It presents the general purpose query facilities offered by LINQ in the upcoming C# 3.0 and VB.NET 9.0 languages. A running example introduces basic LINQ concepts. You'll then learn to query unstructured data using LINQ to XML and relational data with LINQ to SQL. Finally, you'll see how to extend LINQ for custom applications.

About the Technology

LINQ, Language INtegrated Query, is a new extension to the Visual Basic and C# programming languages designed to simplify data queries and database interaction. It addreses O/R mapping issues by making query operations like SQL statements part of the programming language. Adding to its power, LINQ is extensible and can be used to query various data sources. It offers built-in support for querying in-memory collections like arrays or lists, XML, DataSets, and relational databases.

About the book

LINQ in Action will guide you along as you navigate this new world of lambda expressions, query operators, and expression trees. You'll also explore the new features of C# 3.0, VB.NET 9.0. The book is very practical, anchoring each new idea with running code.

You will discover all the basics needed to get a clear understanding of LINQ. Whether you want to use LINQ to query objects, XML documents, or relational databases, you will find all the information you need to get started.

But LINQ in Action does not stop at the basic code. This book also shows you how LINQ can be used for advanced processing of data. This includes coverage of LINQ's extensibility, which allows querying more data sources than those supported by default.

All code samples are built on a concrete business case. The running example, LinqBooks, is a personal book cataloging system that shows you how to create LINQ applications with Visual Studio 2008.

Table of Contents detailed table of contents




about this book


bonus chapter: Working with LINQ and DataSets (available online only from

Part 1 Getting started

1. Introducing LINQ

1.1. What is LINQ?

1.2. Why do we need LINQ?

1.3. Design goals and origins of LINQ

1.4. First steps with LINQ to Objects: Querying collections

in memory === First steps with LINQ to XML: Querying XML documents === First steps with LINQ to SQL: Querying relational databases === Summary

2. C# and VB.NET language enhancements

2.1. Discovering the new language enhancements

2.2. Implicitly typed local variables

2.3. Object and collection initializers

2.4. Lambda expressions

2.5. Extension methods

2.6. Anonymous types

2.7. Summary

3. LINQ building blocks

3.1. How LINQ extends .NET

3.2. Introducing sequences

3.3. Introducing query operators

3.4. Introducing query expressions

3.5. Introducing expression trees

3.6. LINQ DLLs and namespaces

3.7. Summary

Part 2 Querying objects in memory

4. Getting familiar with LINQ to Objects

4.1. Introducing our running example

4.2. Using LINQ with in-memory collections

4.3. Using LINQ with ASP.NET and Windows Forms

4.4. Focus on major standard query operators

4.5. Creating views on an object graph in memory

4.6. Summary

5. Beyond basic in-memory queries

5.1. Common scenarios

5.2. Design patterns

5.3. Performance considerations

5.4. Summary

Part 3 Querying relational data

6. Getting started with LINQ to SQL

6.1. Jump into LINQ to SQL

6.2. Reading data with LINQ to SQL

6.3. Refining our queries

6.4. Working with object trees

6.5. When is my data loaded and why does it matter?

6.6. Updating data

6.7. Summary

7. Peeking under the covers of LINQ to SQL

7.1. Mapping objects to relational data

7.2. Translating query expressions to SQL

7.3. The entity life cycle

7.4. Summary

8. Advanced LINQ to SQL features

8.1. Handling simultaneous changes

8.2. Advanced database capabilities

8.3. Improving the business tier

8.4. A brief diversion into LINQ to Entities

8.5. Summary

Part 4 Manipulating XML

9. Introducing LINQ to XML

9.1. What is an XML API?

9.2. Why do we need another XML programming API?

9.3. LINQ to XML design principles

9.4. LINQ to XML class hierarchy

9.5. Working with XML using LINQ

9.6. Summary

10. Query and transform XML with LINQ to XML

10.1. LINQ to XML axis methods

10.2. Standard query operators

10.3. Querying LINQ to XML objects with XPath

10.4. Transforming XML

10.5. Summary

11. Common LINQ to XML scenarios

11.1. Building objects from XML

11.2. Creating XML from object graphs

11.3. Creating XML with data from a database

11.4. Filtering and mixing data from a database with XML data

11.5. Reading XML and updating a database

11.6. Transforming text files into XML

11.7. Summary

Part 5 LINQing it all together

12. Extending LINQ

12.1. Discovering LINQ�s extension mechanisms

12.2. Creating custom query operators

12.3. Custom implementations of the basic query operators

12.4. Querying a web service: LINQ to Amazon

12.5. IQueryable and IQueryProvider: LINQ to Amazon advanced edition

12.6. Summary

13. LINQ in every layer

13.1. Overview of the LinqBooks application

13.2. LINQ to SQL and the data access layer

13.3. Use of LINQ to XML

13.4. Use of LINQ to DataSet

13.5. Using LINQ to Objects

13.6. Extensibility

13.7. A look into the future

13.8. Summary

Appendix A: appendix: The standard query operators


© 2014 Manning Publications Co.

What's inside

  • Introduction to LINQ in C# and VB.NET
  • How to query objects in memory
  • Manipulating XML with LINQ
  • Mapping objects to relational databases
  • Extending LINQ
  • Common scenarios

About the reader

LINQ in Action is for developers with a working knowledge of the .NET Framework and C# or VB.NET.

About the authors

Fabrice Marguerie is a software architect and developer based in Paris, France. Fabrice is a C# MVP and has been working with LINQ from the first prototypes.

Steve Eichert is a Senior Software Engineer for Algorithmics, Inc. based in Philadelphia, PA.

Jim Wooley has been working with .Net since PDC 2000 and has been actively evangelizing LINQ since its annoucement in 2005. He leads the Atlanta VB Study Group and serves as INETA Membership Manager for the Georgia region.

placing your order...

Don't refresh or navigate away from the page.
print book $29.99 $44.99 pBook + eBook + liveBook
Additional shipping charges may apply
LINQ in Action (print book) added to cart
continue shopping
go to cart

eBook $24.99 $35.99 3 formats + liveBook
LINQ in Action (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks