Home > Store

larger cover

Add To My Wish List

LINQ to Objects Using C# 4.0: Using and Extending LINQ to Objects and Parallel LINQ (PLINQ)

Register your product to gain access to bonus material or receive a coupon.

  • Description
  • Reviews
  • Sample Content
  • Updates

Product Author Bios

Troy Magennis is a Microsoft C# MVP and a keen traveler who currently works for Travelocity, which manages the travel and leisure websites travelocity.com, lastminute.com, and zuji. As Vice President of Architecture, he leads a talented team of architects spread across four continents, committed to being the traveler’s champion. Technology has always been a passion. After cutting his teeth on early 8-bit personal computers, Troy moved into electronic engineering (assembly language coding), which later led to positions in software application development and architecture for some of the most prominent corporations in automotive, banking, and online commerce. Troy’s first exposure to LINQ was in 2006 when he took a sabbatical to learn it and became hooked, ultimately leading him to publish the popular HookedOnLINQ website.

“For several years, Troy has been one of the key figures in the LINQ community. This comprehensive and well-written book serves as a compendium of the important wisdom and experience that he has accumulated through his years of studying LINQ and its uses.”

      –Charlie Calvert, Microsoft C# Community Program Manager

 

“LINQ is changing the way we think about working with data and, in many ways, also about programming in general. LINQ to Objects Using C# 4.0 is a thorough reference that teaches how to simplify many day-to-day tasks with data. It also gives you the foundations that are necessary to understand a wide range of fascinating applications of LINQ that will, no doubt, continue to appear over the next few years.”

      –Tomas Petricek, Microsoft MVP and author of Real-World Functional Programming

 

Your Complete Example-Rich Guide to Using and Extending LINQ to Objects and PLINQ

 

Using LINQ to Objects, .NET developers can write queries over object collections with the same deep functionality that was once available only with SQL and relational databases. Now, for the first time, developers have a comprehensive and authoritative guide to applying LINQ to Objects in real-world software. Microsoft MVP Troy Magennis introduces state-of-the-art techniques for working with in-memory collections more elegantly and efficiently—and writing code that is exceptionally powerful, robust, and flexible.

 

Drawing on his unsurpassed experience coding software using LINQ and hosting the popular HookedOnLINQ.com site, Magennis presents timely, realistic solutions to a wide spectrum of development challenges, such as combining data from multiple sources, and achieving optimal performance with extremely large sets of data. You’ll begin with brief quick-starts that walk you through LINQ to Objects’ key features and query syntax. Next, you’ll drill down to detailed techniques for applying and extending these features with C# 4.0 and C# 3.0—including code examples that reflect the realities of production development.

 

Coverage includes

•    Writing basic LINQ queries with C#: filtering, projecting, and sorting data from in-memory collections

•    Mastering advanced techniques for grouping and joining data and understanding the performance implications of each technique

•    Taking full advantage of LINQ’s standard query operators

•    Creating custom query operators that follow best practices for coding patterns and error handling

•    Writing more fluent, readable LINQ queries with C# 4.0’s language enhancements, including the new dynamic features

•    Combining LINQ with COM-Interop to access data sources such as Microsoft Excel

•    Using Parallel LINQ to Objects (PLINQ) to optimize queries for multi-core processors, and how to build custom parallel query operators

•    Integrating the best LINQ to Objects patterns into your day-to-day coding

Customer Reviews

13 of 14 people found the following review helpful
5.0 out of 5 stars Awsome Resource for .Net Deveopers, March 18, 2010
By 
Reza "A Programming Guru" (Oak Park, US, Canada) - See all my reviews
(REAL NAME)   
Amazon Verified Purchase(What's this?)
This review is from: LINQ to Objects Using C# 4.0: Using and Extending LINQ to Objects and Parallel LINQ (PLINQ) (Addison-Wesley Microsoft Technology Series) (Paperback)
I found this book to be most useful of all the Linq books I have come across. It provides great practical examples of how to use Linq effectively on data objects and save hundreds of lines of code. At the same time, the author explains the performance implications so that you can make the right decision for your application. This book was a great find for me as I had a hard time last year when I tried to use Linq in some complex manipulation of objects involving joins.
The only disappointment for me was the fact that when I first I read the book online on Safari Books, the examples were in color and syntax highlighted. I decided to purchase the printed book to have it as a reference. The print edition is not in color and seems a step backwards.
I highly recommend this book to any developer that uses Linq. Not just for objects. It is well thought out and brilliantly written with real life examples.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


10 of 11 people found the following review helpful
5.0 out of 5 stars Explains basic and advanced concepts succinctly and really well, provides very useful performance tips, May 22, 2010
This review is from: LINQ to Objects Using C# 4.0: Using and Extending LINQ to Objects and Parallel LINQ (PLINQ) (Addison-Wesley Microsoft Technology Series) (Paperback)
LINQ stands for Language INtegrated Query, a technology available to Microsoft DotNet developers since version 3 of the DotNet Framework. LINQ makes working with data such as collections of in-memory objects, rows from database tables, or elements in XML files simpler, providing a set of abstractions that enable developers to manipulate or reshape the source data into something else using more succinct and readable code than the usual deeply-nesting for loops.

This easy to read and very well thought out and written book will not only teach you how to write readable sequential and parallel LINQ queries against collections of in-memory objects, but it also shows you how to create your own custom sequential or parallel operators using the CSharp language. The book also provides illustrations of useful coding patterns, performance tips, and practical advice on what to consider when thinking about parallelizing code.

The book consists of nine chapters. Chapters 1 and... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


6 of 7 people found the following review helpful
5.0 out of 5 stars Exceptional Book In Content and Style, June 8, 2010
By 
Mark Phillips (NY, NY United States) - See all my reviews
This review is from: LINQ to Objects Using C# 4.0: Using and Extending LINQ to Objects and Parallel LINQ (PLINQ) (Addison-Wesley Microsoft Technology Series) (Paperback)
All of LINQ is covered from .NET 3.0 - .NET 4.0. It is written by someone who clearly is a master of LINQ and knows how to communicated his mastery. Detailed explanations and examples are provided for all LINQ operators, helping the developer to know when and where to use each. I have purchased a few LINQ books. To me, this was the clearest and most consise. This book is the new classic book for LINQ.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


Share your thoughts with other customers:
 See all 13 customer reviews...

Online Sample Chapter

C# 4.0 Features

Table of Contents

Foreword . . . x

Preface . . . xii

Acknowledgments . . . xix

About the Author . . . xx

Chapter 1: Introducing LINQ . . . 1

What Is LINQ? . . . 1

The (Almost) Current LINQ Story . . . 3

LINQ Code Makeover–Before and After Code Examples . . . 5

Benefits of LINQ . . . 12

Summary . . . 15

References . . . 15

Chapter 2: Introducing LINQ to Objects . . . 17

LINQ Enabling C# 3.0 Language Enhancements . . . 17

LINQ to Objects Five-Minute Overview . . . 30

Summary . . . 39

References . . . 39

Chapter 3: Writing Basic Queries . . . 41

Query Syntax Style Options . . . 41

How to Filter the Results (Where Clause) . . . 49

How to Change the Return Type (Select Projection) . . . 54

How to Return Elements When the Result Is a Sequence (Select Many) . . . 59

How to Get the Index Position of the Results . . . 61

How to Remove Duplicate Results . . . 62

How to Sort the Results . . . 63

Summary . . . 73

Chapter 4: Grouping and Joining Data . . . 75

How to Group Elements . . . 75

How to Join with Data in Another Sequence . . . 93

Summary . . . 119

Chapter 5: Standard Query Operators . . . 121

The Built-In Operators . . . 121

Aggregation Operators–Working with Numbers . . . 123

Conversion Operators–Changing Types . . . 131

Element Operators . . . 144

Equality Operator–SequenceEqual . . . 153

Generation Operators–Generating Sequences of Data . . . 155

Merging Operators . . . 159

Partitioning Operators–Skipping and Taking Elements . . . 160

Quantifier Operators–All, Any, and Contains . . . 164

Summary . . . 171

Chapter 6: Working with Set Data . . . 173

Introduction . . . 173

The LINQ Set Operators . . . 174

The HashSet<T> Class . . . 185

Summary . . . 192

Chapter 7: Extending LINQ to Objects . . . 195

Writing a New Query Operator . . . 195

Writing a Single Element Operator . . . 196

Writing a Sequence Operator . . . 208

Writing an Aggregate Operator . . . 216

Writing a Grouping Operator . . . 222

Summary . . . 232

Chapter 8: C# 4.0 Features . . . 233

Evolution of C# . . . 233

Optional Parameters and Named Arguments . . . 234

Dynamic Typing . . . 243

COM-Interop and LINQ . . . 251

Summary . . . 260

References . . . 260

Chapter 9: Parallel LINQ to Objects . . . 261

Parallel Programming Drivers . . . 261

Multi-Threading Versus Code Parallelism . . . 264

Parallelism Expectations, Hindrances, and Blockers . . . 267

LINQ Data Parallelism . . . 271

Writing Parallel LINQ Operators . . . 289

Summary . . . 301

References . . . 301

Glossary . . . 303

Index . . . 307

Sample Pages

Download the sample pages (includes Chapter 8 and Index)

 
Best Value

Book + eBook Bundle  $89.98  $53.99

Book Price $39.99
eBook Price $14.00
eBook formats included

Buy

This book includes free shipping!

Buy

Book  $49.99  $39.99

Usually ships in 24 hours.

This book includes free shipping!

Buy

eBook (Watermarked)  $39.99  $31.99

Includes EPUB, MOBI, and PDF
About eBook Formats

This eBook includes the following formats, accessible from your Account page after purchase:

ePubEPUBThe open industry format known for its reflowable content and usability on supported mobile devices.

MOBIMOBIThe eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

Adobe ReaderPDFThe popular standard, used most often with the free Adobe® Reader® software.

This eBook requires no passwords or activation to read. We customize your eBook by discretely watermarking it with your name, making it uniquely yours.

Purchase Reward: One Month Free Subscription
By completing any purchase on InformIT, you become eligible for an unlimited access one-month subscription to Safari Books Online.

Get access to thousands of books and training videos about technology, professional development and digital media from more than 40 leading publishers, including Addison-Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media, Wrox, Apress, and many more. If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months. That's a total savings of $199.