O'Reilly logo

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

Pro LINQ: Language Integrated Query in C# 2008

Book Description

LINQ is the project name for a set of extensions to the .NET Framework that provide a generic approach to querying data from different data sources. LINQ will premier in Visual Studio 2008, and will become the next must-have skill for .NET developers. For more information about LINQ, you can check out the author's portal at www.LINQdev.com.

Pro LINQ: Language Integrated Query in C# 2008 is all about code.

Literally, this book starts with code and ends with code. In most books, the author shows the simplest example demonstrating how to use a method, but they so rarely show how to use the more complex prototypes. Pro LINQ: Language Integrated Query in C# 2008 is different. Demonstrating the overwhelming majority of LINQ operators and protoypes, it is a veritable treasury of LINQ examples.

Rather than obscure the relevant LINQ principles in code examples by focusing on a demonstration application you have no interest in writing, Pro LINQ: Language Integrated Query in C# 2008 cuts right to the chase of each LINQ operator, method, or class. However, where complexity is necessary to truly demonstrate an issue, the examples are right there in the thick of it. For example, code samples demonstrating how to handle concurrency conflicts actually create concurrency conflicts so you can step through the code and see them unfold.

Most books tell you about the simple stuff, while few books warn you of the pitfalls. Where Pro LINQ: Language Integrated Query in C# 2008 returns your investment is in the hours, and sometimes days, spent by the author determining why something may not work as expected. Sometimes this results in an innocent looking paragraph that may take you a minute to read and understand, but took days to research and explain.

Face it, most technical books while informative, are dull. LINQ need not be dull. Written with a sense of humor, Pro LINQ: Language Integrated Query in C# 2008 will attempt to entertain you on your journey through the wonderland of LINQ and C# 2008.

Table of Contents

  1. Copyright
  2. Dedication
  3. About the Author
  4. About the Technical Reviewer
  5. Acknowledgments
  6. Pro LINQ: Language Integrated Query in C# 2008
    1. Hello LINQ
      1. A Paradigm Shift
      2. Introduction
      3. LINQ Is Not Just for Queries
      4. Tips to Get You Started
      5. Summary
    2. C# 3.0 Language Enhancements for LINQ
      1. New C# 3.0 Language Additions
      2. Summary
  7. LINQ to Objects
    1. LINQ to Objects Introduction
      1. LINQ to Objects Overview
      2. IEnumerable<T>, Sequences, and the Standard Query Operators
      3. Returning IEnumerable<T>, Yielding, and Deferred Queries
      4. Func Delegates
      5. The Standard Query Operators Alphabetical Cross-Reference
      6. Summary
    2. Deferred Operators
      1. Referenced Namespaces
      2. Referenced Assemblies
      3. Common Classes
      4. The Deferred Operators by Purpose
      5. Summary
    3. Nondeferred Operators
      1. Referenced Namespaces
      2. Common Classes
      3. The Nondeferred Operators by Purpose
      4. Summary
  8. LINQ to XML
    1. LINQ to XML Introduction
      1. Introduction
      2. Cheating the W3C DOM XML API
      3. Summary
    2. The LINQ to XML API
      1. Referenced Namespaces
      2. Significant API Design Enhancements
      3. The LINQ to XML Object Model
      4. Deferred Query Execution, Node Removal, and the Halloween Problem
      5. XML Creation
      6. XML Output
      7. XML Input
      8. XML Traversal
      9. XML Modification
      10. XML Attributes
      11. XML Annotations
      12. XML Events
      13. Summary
    3. LINQ to XML Operators
      1. Introduction to LINQ to XML Operators
      2. Ancestors
      3. AncestorsAndSelf
      4. Attributes
      5. DescendantNodes
      6. DescendantNodesAndSelf
      7. Descendants
      8. DescendantsAndSelf
      9. Elements
      10. InDocumentOrder
      11. Nodes
      12. Remove
      13. Summary
    4. Additional XML Capabilities
      1. Referenced Namespaces
      2. Queries
      3. Transformations
      4. Validation
      5. XPath
      6. Summary
  9. LINQ to DataSet
    1. LINQ to DataSet Operators
      1. Assembly References
      2. Referenced Namespaces
      3. Common Code for the Examples
      4. DataRow Set Operators
      5. DataRow Field Operators
      6. DataTable Operators
      7. Summary
    2. Additional DataSet Capabilities
      1. Required Namespaces
      2. Typed DataSets
      3. Putting It All Together
      4. Summary
  10. LINQ to SQL
    1. LINQ to SQL Introduction
      1. Introducing LINQ to SQL
      2. Prerequisites for Running the Examples
      3. Using the LINQ to SQL API
      4. IQueryable<T>
      5. Some Common Methods
      6. Summary
    2. LINQ to SQL Tips and Tools
      1. Introduction to LINQ to SQL Tips and Tools
      2. Tips
      3. Tools
      4. Use SQLMetal and the O/R Designer Together
      5. Summary
    3. LINQ to SQL Database Operations
      1. Prerequisites for Running the Examples
      2. Standard Database Operations
      3. Overriding Database Modification Statements
      4. SQL Translation
      5. Summary
    4. LINQ to SQL Entity Classes
      1. Prerequisites for Running the Examples
      2. Entity Classes
      3. Extending Entity Classes with Partial Methods
      4. Important System.Data.Linq API Classes
      5. Summary
    5. The DataContext
      1. Prerequisites for Running the Examples
      2. [Your]DataContext Class
      3. The DataContext Class
      4. Summary
    6. Concurrency Conflicts
      1. Prerequisites for Running the Examples
      2. Concurrency Conflicts
      3. Summary
    7. Additional SQL Capabilities
      1. Prerequisites for Running the Examples
      2. Database Views
      3. Entity Class Inheritance
      4. Transactions
      5. Summary