linq (from the inside)

24
Linq (from the inside) Reinventing the Linq to Objects wheel Mike Clement [email protected] @mdclement

Upload: michael-clement

Post on 10-May-2015

1.946 views

Category:

Technology


2 download

DESCRIPTION

Knowing how to use Linq is useful if you're doing any coding using .NET 3.5 or newer. But have you ever thought about what is going on "under the hood"?Join us as we dive into the guts of Linq and implement Linq extension methods such as Where, Select, Any, All and Aggregate. Not only is it interesting to see what's going on, it'll help you to build better code using Linq.

TRANSCRIPT

Page 1: Linq (from the inside)

Linq (from the inside)

Reinventing the Linq to Objects wheelMike Clement

[email protected]@mdclement

Page 2: Linq (from the inside)
Page 3: Linq (from the inside)
Page 4: Linq (from the inside)
Page 5: Linq (from the inside)
Page 6: Linq (from the inside)
Page 7: Linq (from the inside)

LINQ to AmazonLINQ to Active DirectoryLINQ to Bindable Sources (SyncLINQ)LINQ to C# projectLINQ to Continuous Data (CLinq)LINQ to CRMLINQ To Geo - Language Integrated Query for Geospatial DataLINQ to ExcelLINQ to Expressions (MetaLinq)LINQ Extender (Toolkit for building LINQ Providers)LINQ to FlickrLINQ to GoogleLINQ to Indexes (LINQ and i40)LINQ to IQueryable (Matt Warren on Providers)LINQ to JSONLINQ to LDAPLINQ to NHibernateLINQ to JavaScriptLINQ to LLBLGen ProLINQ to LuceneLINQ to Metaweb(freebase)

LINQ to MySQL, Oracle and PostgreSql (DbLinq)LINQ to NCoverLINQ to Opf3LINQ to Parallel (PLINQ)LINQ to RDF FilesLINQ to SharepointLINQ to SimpleDBLINQ to StreamsLINQ to TwitterLINQ to WebQueriesLINQ to WMI

http://tomasp.net/blog/linq-expand.aspxhttp://tomasp.net/blog/linq-expand-update.aspx

Linq To WIQLLINQ to XtraGrid

Source: http://blogs.msdn.com/b/charlie/archive/2006/10/05/links-to-linq.aspx

Page 8: Linq (from the inside)

If I have seen further it is by standing on the shoulders of giants.

-Sir Issac Newton

Page 9: Linq (from the inside)

http://stackoverflow.com/users/22656/jon-skeet

Page 10: Linq (from the inside)

• Jon Skeet is immutable. If something’s going to change, it’s going to have to be the rest of the universe.

• Jon Skeet is the only top 100 SO user who is human. The others are bots that he coded to pass the time between questions.

• Jon Skeet does not use revision control software. None of his code has ever needed revision.

• When Jon Skeet’s code fails to compile, the compiler apologizes.• Jon Skeet is the traveling salesman. Only he knows the shortest

route.• The Dining Philosophers wait while Jon Skeet eats.• When Jon Skeet points to null, null quakes in fear.• Jon Skeet does not use exceptions when programming. He has

not been able to identify any of his code that is not exceptional.

Page 11: Linq (from the inside)

• Jon Skeet has already written a book about C# 5.0.

• It’s currently sealed up.• In three years, Anders Hejlsberg is going to

open the book to see if the language design team got it right

Page 12: Linq (from the inside)

from cust in customerswhere cust.City == "London"select cust;

customers.Where(cust => cust.City == "London");

Page 13: Linq (from the inside)

C# Language Features

• Query Expressions• Implicitly Typed Variables• Object and Collection Initializers• Anonymous Types• Extension Methods• Lambda Expressions• Auto-implemented Properties

• Iterator blocks• Generics

Page 14: Linq (from the inside)

public static void Method(this IInterface myInterface, int i)

Anatomy of an extension method

Page 15: Linq (from the inside)
Page 16: Linq (from the inside)
Page 17: Linq (from the inside)
Page 18: Linq (from the inside)

IMPLEMENT LINQ TO OBJECTSLearning by Doing… we’ll figure it out as we go.

Page 19: Linq (from the inside)
Page 20: Linq (from the inside)
Page 21: Linq (from the inside)

C# Language Features

• Query Expressions• Implicitly Typed Variables• Object and Collection Initializers• Anonymous Types• Extension Methods• Lambda Expressions• Auto-implemented Properties

• Iterator blocks• Generics

Page 23: Linq (from the inside)

Action Items!

• Read Jon Skeet’s EduLinq series.• Download my “starter” and play!• If you aren’t already, use Linq in your everyday

coding.• Look for other Linq operators to implement.• Attend the Utah Software Craftsmanship

Group!

Page 24: Linq (from the inside)

Me

• @mdclement• [email protected]• http://blog.softwareontheside.com• Utah Software Craftsmanship Group

– https://groups.google.com/forum/#!forum/ut-software-craftsmanship

– @utahsc– First Wednesday, Neumont, Room 300