■ Contents
xx
Lambda Expressions ...........................................................................................................................447
Extension Methods ............................................................................................................................. 448
Anonymous Types ............................................................................................................................... 449
Understanding the Role of LINQ ................................................................................... 449
LINQ Expressions Are Strongly Typed ................................................................................................. 450
The Core LINQ Assemblies .................................................................................................................. 450
Applying LINQ Queries to Primitive Arrays ................................................................... 451
Once Again, Using Extension Methods ............................................................................................... 453
Once Again, Without LINQ ................................................................................................................... 453
Reflecting Over a LINQ Result Set ...................................................................................................... 454
LINQ and Implicitly Typed Local Variables .......................................................................................... 455
LINQ and Extension Methods .............................................................................................................. 457
The Role of Deferred Execution ..........................................................................................................458
The Role of Immediate Execution ....................................................................................................... 459
Returning the Result of a LINQ Query ........................................................................... 460
Returning LINQ Results via Immediate Execution .............................................................................. 461
Applying LINQ Queries to Collection Objects ................................................................ 462
Accessing Contained Subobjects ....................................................................................................... 462
Applying LINQ Queries to Nongeneric Collections .............................................................................. 463
Filtering Data Using OfType<T>( ) ...................................................................................................... 464
Investigating the C# LINQ Query Operators .................................................................. 465
Basic Selection Syntax ....................................................................................................................... 466
Obtaining Subsets of Data .................................................................................................................. 467
Projecting New Data Types ................................................................................................................. 468
Obtaining Counts Using Enumerable ..................................................................................................469
Reversing Result Sets ......................................................................................................................... 470
Sorting Expressions ............................................................................................................................470
LINQ As a Better Venn Diagramming Tool ........................................................................................... 471
Removing Duplicates ..........................................................................................................................472
LINQ Aggregation Operations .............................................................................................................. 472