A comprehensive and practical guide to LINQ, the most important new feature in Visual Studio 2008.
Author(s): Paul Kimmel
Publisher: Sams Publishing
Year: 2008
Language: English
Pages: 527
LINQ Unleashed for C#
Table of Contents
Introduction
Conventions Used in This Book
Part I: Getting Ready for LINQ
1 Programming with Anonymous Types
Understanding Anonymous Types
Programming with Anonymous Types
Databinding Anonymous Types
Testing Anonymous Type Equality
Using Anonymous Types with LINQ Queries
Introducing Generic Anonymous Methods
Summary
2 Using Compound Type Initialization
Initializing Objects with Named Types
Initializing Anonymous Types
Initializing Collections
Using Conversion Operators
Summary
3 Defining Extension and Partial Methods
Extension Methods and Rules of the Road
Defining Extension Methods
How Extension Methods Support LINQ
Implementing a "Talking" String Extension Method
Defining Partial Methods
Summary
4 yield return: Using .NET's State Machine Generator
Understanding How yield return Works
Using yield return and yield break
Summary
5 Understanding Lambda Expressions and Closures
Understanding the Evolution from Function Pointers to Lambda Expressions
Writing Basic Lambda Expressions
Dynamic Programming with Lambda Expressions
Lambda Expressions and Closures
Currying
Summary
6 Using Standard Query Operators
Understanding How LINQ Is Implemented
Constructing a LINQ Query
Filtering Information
Using Quantifiers
Partitioning with Skip and Take
Using Generation Operations
Equality Testing
Obtaining Specific Elements from a Sequence
Appending Sequences with Concat
Summary
Part II: LINQ for Objects
7 Sorting and Grouping Queries
Sorting Information
Grouping Information
Summary
8 Using Aggregate Operations
Aggregating
Averaging Collection Values
Counting Elements
Finding Minimum and Maximum Elements
Summing Query Results
Median: Defining a Custom Aggregation Operation
Summary
9 Performing Set Operations
Finding Distinct Elements
Defining Exclusive Sets with Intersect and Except
Creating Composite Resultsets with Union
Summary
10 Mastering Select and SelectMany
Exploring Select
Projecting New Types from Multiple Sources
Creating a New Sequence from Multiple Sequences with SelectMany
Using SelectMany with Indexes
Summary
11 Joining Query Results
Using Multiple From Clauses
Defining Inner Joins
Using Custom, or Nonequijoins
Implementing Group Join and Left Outer Join
Implementing a Cross Join
Defining Joins Based on Composite Keys
Summary
12 Querying Outlook and Active Directory
LINQ to Outlook
Querying Active Directory with Straight C# Code
LINQ to Active Directory
Querying Active Directory with LINQ
Summary
Part III: LINQ for Data
13 Querying Relational Data with LINQ
Defining Table Objects
Connecting to Relational Data with DataContext Objects
Querying DataSets
SqlMetal: Using the Entity Class Generator Tool
Using the LINQ to SQL Class Designer
Summary
14 Creating Better Entities and Mapping Inheritance and Aggregation
Defining Better Entities with Nullable Types
Mapping Inheritance Hierarchies for LINQ to SQL
Adding EntitySet Classes as Properties
Creating Databases with LINQ to SQL
Summary
15 Joining Database Tables with LINQ Queries
Defining Joins with LINQ to DataSet
Defining Joins with LINQ to SQL
Querying Views with LINQ
Databinding with LINQ to SQL
Summary
16 Updating Anonymous Relational Data
Adding and Removing Data
Calling User-Defined Functions
Using Transactions
Understanding Conflict Resolution
N-Tier Applications and LINQ to SQL
Summary
17 Introducing ADO.NET 3.0 and the Entity Framework
Understanding the General Nature of the Problem and the Solution
Finding Additional Resources
Building a Sample Application Using Vanilla ADO.NET Programming
Programming with the Entity Framework
Doing It All with LINQ
Summary
Part IV: LINQ for XML
18 Extracting Data from XML
Loading XML Documents
Querying XML Documents
Loading XML from a String
Handling Missing Data
Using Query Expressions with XML Data
Annotating Nodes
Summary
19 Comparing LINQ to XML with Other XML Technologies
Comparing LINQ to XML with XPath
Comparing LINQ to XML Transformations with XSLT
Transforming XML Data Using Functional Construction
Summary
20 Constructing XML from Non-XML Data
Constructing XML from CSV Files
Generating Text Files from XML
Using XML and Embedded LINQ Expressions (in VB)
Summary
21 Emitting XML with the XmlWriter
Exploring the XmlWriter, Quickly
Using XmlTextWriter to Write an XML File
Summary
22 Combining XML with Other Data Models
Creating XML from SQL Data
Updating SQL Data from XML
Summary
23 LINQ to XSD Supports Typed XML Programming
Understanding the Basic Design Goals of LINQ to XSD
Programming with LINQ to XSD
Summary
Index
A
B
C
D
E
F
G
H
I
J
K–L
M
N
O
P
Q
R
S
T
U
V
W
X–Z