Hooked on LINQ

Hooked on LINQ - Developers' Wiki
for .NET Language Integrated Query

Quick Search

Advanced Search »
Edit

Details

Book Cover

Book Cover

Title: LINQ to Objects Using C# 4.0: Using and Extending LINQ to Objects and Parallel LINQ (PLINQ)
Paperback: 300 pages
Publisher: Addison-Wesley Professional; 1 edition (March 20, 2010)
Language: English
ISBN-10: 0321637003
ISBN-13: 978-0321637000


Read the Rough-Cut on Safari right now


or pre-order it on Amazon (due early 2010 to co-incide with Visual Studio 2010 release).



Edit

Samples


Download the latest samples from here.


OR - view the sample code, and Console output online -


Chapter 1 Code Listings and Console Output
Chapter 2 Code Listings and Console Output
Chapter 3 Code Listings and Console Output
Chapter 4 Code Listings and Console Output
Chapter 5 Code Listings and Console Output
Chapter 6 Code Listings and Console Output
Chapter 7 Code Listings and Console Output
Chapter 8 Code Listings and Console Output
Chapter 9 Code Listings and Console Output


Edit

Table of Contents

Preface

Chapter 1 - Introducing LINQ
What is LINQ?
The (Almost) Current LINQ Story
LINQ Code Makeover – Before and After Code Examples
  LINQ to Objects – Grouping and Sorting Contact Records
  LINQ to Objects – Summarizing Data from Two Collections and Writing XML
Benefits of LINQ
  Single query language to remember
  Compile-time Type Checking
  Easier to Read Code
  Over Fifty Standard Query Operators
  Open and Extensible Architecture
  Expressing Code as Data
Summary
References
Chapter 1 Code Listings and Console Output


Chapter 2 - Introducing LINQ to Objects
LINQ Enabling C# 3.0 Language Enhancements
  Extension Methods
  Object Initializers
  Collection Initializers
  Implicitly Typed Local Variables
  Anonymous Types
  Lambda Expressions
  Query Expressions
LINQ to Objects 5 Minute Overview
Summary
References
Chapter 2 Code Listings and Console Output


Chapter 3 - Writing Basic Queries
Query Syntax Style Options
Query Expression Syntax
Comparing the Query Syntax Options
How to filter the results (Where clause)
  Where Filter Using a Lambda Expression
  Where Filter Query Expressions (Preferred)
  Using an External Method for Evaluation
  Filtering by Index Position
How to Change the Return Type (Select Projection)
  Return the Same Type as the Source
  Return a single result value or type
  Return a Collection of a Given Type (different to the source type)
  Return an Anonymous Type (a type created on-the-fly)
  Return a set of grouped objects
  How to Return Elements When the Result is a Sequence (Select Many)
  How to Get the Index Position of the Results
  How to remove duplicate results
How to sort the results
  Basic sorting syntax
  Reversing the Order of a Result Sequence (Reverse)
  Case In-Sensitive and Cultural Specific String Ordering
  Specifying Your Own Custom Sort Comparison Function
Summary
Chapter 3 Code Listings and Console Output


Chapter 4 - Grouping and Joining Data
How to Group Elements
  Working with Groups
  Specifying a Key to Group By
  Grouping by Composite Keys (more than one value)
  Specifying Your Own Key Comparison Function
  Projecting Grouped Elements into a New type
  How to Use Grouping Results in the Same Query (Query Continuation)
How to Join With Data in Another Sequence
  Cross-Joins
  One to One Joins
  One-to-Many Joins
Summary
Chapter 4 Code Listings and Console Output


Chapter 5 - Standard Query Operators
The Standard Query Operators
Aggregation Operators – Working with Numbers
  Aggregate Operator
  Average, Max, Min and Sum Operators
Count and LongCount Operators
Conversion Operators - Changing Types
  AsEnumerable Operator
  Cast Operator
  OfType Operator
  ToArray Operator
  ToDictionary Operator
  ToList Operator
  ToLookup Operator
Element Operators
  DefaultIfEmpty Operator
  ElementAt and ElementAtOrDefault Operators
  First and FirstOrDefault Operators
  Last, and LastOrDefault Operators
  Single and SingleOrDefault Operators
Equality Operator – SequenceEqual
  SequenceEqual Operator
Generation Operators - Generating Sequences of Data
  Empty Operator
  Range Operator
  Repeat Operator
Merging Operators
  Zip Operator
Partitioning Operators - Skipping and Taking Elements
  Skip and Take Operators
  SkipWhile and TakeWhile Operators
Quantifier Operators – All, Any and Contains
  All Operator
  Any Operator
  Contains Operator
Summary
Chapter 5 Code Listings and Console Output


Chapter 6 - Working with Set Data
Introduction
The LINQ Set Operators
  Concat Operator
  Distinct Operator
  Except Operator
  Intersect Operator
  Union Operator
   Custom EqualityComparer’s When Using LINQ Set Operators
The HashSet Class
Summary
Chapter 6 Code Listings and Console Output


Chapter 7 - Extending LINQ to Objects
How to write a new query operator
  Writing a Single Element Operator
    Building Our Own Last operator
    Building the RandomElement Operator
  Writing a Sequence Operator
    Building the TakeRange Operator
  Writing an Aggregate Operator
    The Min Operator
    Building the LongSum Operator
  Writing a Grouping Operator
    Grouping Collection Implementation
    Building the Segment Operator
Summary
Chapter 7 Code Listings and Console Output


Chapter 8 - C# 4.0 Features
Evolution of C#
Optional and Named Arguments
  Optional Arguments
  Named Arguments
  Using Named and Optional Arguments in LINQ Queries
Dynamic Typing
  Dynamic Typing
  Using dynamic Types in LINQ Queries
COM-Interop and LINQ
  Adding a COM-Interop Reference
  Building the Microsoft Excel Row Iterator
Summary
References
Chapter 8 Code Listings and Console Output


Chapter 9 - Parallel LINQ to Objects
Parallel Programming Drivers
History of processor speed and multi-core processors
Multi-Threading Versus Code Parallelism
Parallelism Expectations, Hindrances and Blockers
  Amdahl’s Law – You will still be as slow as the longest sequential part
  Parallel Overhead – Finding the Ideal Work Partition Size
  Synchronization – Parallel partitions working as a team
  Data Ordering
  Exceptions – Who stops when something fails?
  Dealing with these constraints
LINQ Data Parallelism
  Parallelizing a Query – Geonames Example
  What Happens During a Parallel LINQ Query?
  It’s not as simple as just adding .AsParallel()
  The AsParallel() and AsSequential() Operators
Writing Parallel LINQ Operators
  Parallel Operator Strategy
  Building a Parallel Aggregate Operator – Sample StandardDeviation
Summary
References
Chapter 9 Code Listings and Console Output


Glossary References Index

If you would like to comment on this page, click on the Discuss button located on the top-right of each page. Feel free to edit any mistakes or omissions you find. If you have an objection or find in-appropriate content then contact the administrator. This website is not affiliated with Microsoft®, all content and opinions are those of the specific author and some advice, solutions and article may contain unintentional errors - please use care. Powered by ScrewTurn Wiki version 2.0.33. Some of the icons created by FamFamFam.