SlideShare a Scribd company logo
Linq (from the inside)

Reinventing the Linq to Objects wheel
           Mike Clement
   mike@softwareontheside.com
            @mdclement
Linq (from the inside)
Linq (from the inside)
Linq (from the inside)
Linq (from the inside)
Linq (from the inside)
LINQ to Amazon                              LINQ to Metaweb(freebase)
LINQ to Active Directory                    LINQ to MySQL, Oracle and
LINQ to Bindable Sources (SyncLINQ)         PostgreSql (DbLinq)
LINQ to C# project                          LINQ to NCover
LINQ to Continuous Data (CLinq)             LINQ to Opf3
LINQ to CRM                                 LINQ to Parallel (PLINQ)
LINQ To Geo - Language Integrated Query for LINQ to RDF Files
Geospatial Data                             LINQ to Sharepoint
LINQ to Excel                               LINQ to SimpleDB
LINQ to Expressions (MetaLinq)              LINQ to Streams
LINQ Extender (Toolkit for building LINQ    LINQ to Twitter
Providers)                                  LINQ to WebQueries
LINQ to Flickr                              LINQ to WMI
LINQ to Google                                   http://tomasp.net/blog/linq-
LINQ to Indexes (LINQ and i40)                   expand.aspx
LINQ to IQueryable (Matt Warren on               http://tomasp.net/blog/linq-expand-
Providers)                                       update.aspx
LINQ to JSON                                Linq To WIQL
LINQ to LDAP                                LINQ to XtraGrid
LINQ to NHibernate
LINQ to JavaScript                          Source:
LINQ to LLBLGen Pro                         http://blogs.msdn.com/b/charlie/archive/20
LINQ to Lucene                              06/10/05/links-to-linq.aspx
If I have seen
further it is by
standing on the
shoulders of giants.
           -Sir Issac Newton
http://stackoverflow.com/users/22656/jon-skeet
• 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.
• 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
from cust in customers
where cust.City == "London"
select cust;

customers.Where(
cust => cust.City == "London");
C# Language Features
•   Query Expressions
•   Implicitly Typed Variables
•   Object and Collection Initializers
•   Anonymous Types
•   Extension Methods
•   Lambda Expressions
•   Auto-implemented Properties

• Iterator blocks
• Generics
Anatomy of an extension method

public static void
Method(this IInterface
myInterface, int i)
Linq (from the inside)
Linq (from the inside)
Linq (from the inside)
Learning by Doing… we’ll figure it out as we go.

IMPLEMENT LINQ TO OBJECTS
Linq (from the inside)
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
Resources
•   Classification by Manner of Execution
•   C# Features
•   List of Linq Providers (and other links)
•   EduLinq code blog posts (from Jon Skeet)
•   MoreLinq (from Jon Skeet)
•   My Starter Project
    – https://github.com/mdclement/Linq--from-the-
      inside--Presentation-Base
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!
Me
•   @mdclement
•   mike@softwareontheside.com
•   http://blog.softwareontheside.com
•   Utah Software Craftsmanship Group
    – https://groups.google.com/forum/#!forum/ut-
      software-craftsmanship
    – @utahsc
    – First Wednesday, Neumont, Room 300

More Related Content

PDF
Elixir + GraphQL = Absinthe 2019.04.10
PDF
Backend to frontend
PDF
Keynote Open Source Diversity - Festival del Software Libre
PDF
Golab.io
PPTX
PyCon TW 2017 - Why do projects fail? Let's talk about the story of Sinon.PY
PDF
Developing modular applications with Java EE 6 and Enterprise OSGi + WebSpher...
PPTX
How To Write a Testable Code
ODP
Elixir absinthe-basics
Elixir + GraphQL = Absinthe 2019.04.10
Backend to frontend
Keynote Open Source Diversity - Festival del Software Libre
Golab.io
PyCon TW 2017 - Why do projects fail? Let's talk about the story of Sinon.PY
Developing modular applications with Java EE 6 and Enterprise OSGi + WebSpher...
How To Write a Testable Code
Elixir absinthe-basics

Viewers also liked (17)

PPT
Object Relational Mapping with LINQ To SQL
PPTX
LINQ 概要 + 結構便利な LINQ to XML
PPTX
Think in linq
PPTX
Poster research
PPT
1 201010243711613
PDF
Buku dinamika opt
PPTX
Amma paranja 8 kathakal
PPTX
LINQ in C#
PDF
Summer Beach Trip Packing List
PPTX
Bong montesa mapping gph milf fa
PDF
Lucie McLean — Come Together: Building Product Culture in Non-Digital Organis...
PPTX
Philippines | Rebels, tribal leaders to ‘marry’ ideals
PPTX
THE OWL AND THE PUSSY CAT- ppt
PPTX
El gran gimnasta santacruzano
PDF
Hot Amala Paul
PDF
Step Daughter Ch. 05
Object Relational Mapping with LINQ To SQL
LINQ 概要 + 結構便利な LINQ to XML
Think in linq
Poster research
1 201010243711613
Buku dinamika opt
Amma paranja 8 kathakal
LINQ in C#
Summer Beach Trip Packing List
Bong montesa mapping gph milf fa
Lucie McLean — Come Together: Building Product Culture in Non-Digital Organis...
Philippines | Rebels, tribal leaders to ‘marry’ ideals
THE OWL AND THE PUSSY CAT- ppt
El gran gimnasta santacruzano
Hot Amala Paul
Step Daughter Ch. 05
Ad

Similar to Linq (from the inside) (20)

PDF
cadec-2017-golang
PDF
How We Fixed Our MongoDB Problems
PDF
PyData Texas 2015 Keynote
PDF
Reaktive Programmierung mit den Reactive Extensions (Rx)
PPTX
How and Why you can and should Participate in Open Source Projects (AMIS, Sof...
PDF
Wondershare Filmora 14.3.2 Crack + License Key Free Download
PDF
2025-03-20 - How to use AI to your advantage - AI-Driven Development.pdf
PDF
AOMEI Backupper Crack 2025 FREE Download
PDF
Wondershare PDFelement Pro Crack FREE Download
PDF
DDD Tactical Design with Clean Architecture - Ivan Paulovich
PPTX
Lisp in the Cloud
KEY
UCLA HACKU'11
PDF
RubyStack: the easiest way to deploy Ruby on Rails
PDF
MCN 2014: Make One, Contribute Many: Sharing Image Metadata via LIDO
PPTX
"Python web development combines the simplicity of the language with powerful...
PDF
Building GUI App with Electron and Lisp
PPTX
Sp biz conf - using office graph api
PPTX
SQL ttrain wrwrwrw wwrw wwrrrwrwrwrwwrwr.pptx
PDF
Modern ClojureScript
cadec-2017-golang
How We Fixed Our MongoDB Problems
PyData Texas 2015 Keynote
Reaktive Programmierung mit den Reactive Extensions (Rx)
How and Why you can and should Participate in Open Source Projects (AMIS, Sof...
Wondershare Filmora 14.3.2 Crack + License Key Free Download
2025-03-20 - How to use AI to your advantage - AI-Driven Development.pdf
AOMEI Backupper Crack 2025 FREE Download
Wondershare PDFelement Pro Crack FREE Download
DDD Tactical Design with Clean Architecture - Ivan Paulovich
Lisp in the Cloud
UCLA HACKU'11
RubyStack: the easiest way to deploy Ruby on Rails
MCN 2014: Make One, Contribute Many: Sharing Image Metadata via LIDO
"Python web development combines the simplicity of the language with powerful...
Building GUI App with Electron and Lisp
Sp biz conf - using office graph api
SQL ttrain wrwrwrw wwrw wwrrrwrwrwrwwrwr.pptx
Modern ClojureScript
Ad

More from Mike Clement (20)

PPTX
Collaboration Principles from Mob Programming
PPTX
Focus on Flow: Lean Principles in Action
PPTX
Taming scary production code that nobody wants to touch
PPTX
Develop your sense of code smell
PPTX
Maps over Backlogs: User Story Mapping to Share the Big Picture
PPTX
Escaping the Pitfalls of Software Product Development
PPTX
Put the Tests Before the Code
PDF
Mob Programming for Continuous Learning
PPTX
Play to Learn: Agile Games with Cards and Dice
PPTX
The Quest for Continuous Delivery at Pluralsight
PPTX
Software Craftsmanship and Agile Code Games
PPTX
Thinking in F#
PPTX
Transformation Priority Premise: TDD Test Order Matters
PPTX
Power of Patterns: Refactoring to (or away from) Patterns
PPTX
Code Katas Spring 2012
PPTX
FizzBuzz Guided Kata
PPTX
Bowling Game Kata in C# Adapted
PPTX
Code Katas: Practicing Your Craft
PPTX
Software Craftsmanship
PPTX
Using Rhino Mocks for Effective Unit Testing
Collaboration Principles from Mob Programming
Focus on Flow: Lean Principles in Action
Taming scary production code that nobody wants to touch
Develop your sense of code smell
Maps over Backlogs: User Story Mapping to Share the Big Picture
Escaping the Pitfalls of Software Product Development
Put the Tests Before the Code
Mob Programming for Continuous Learning
Play to Learn: Agile Games with Cards and Dice
The Quest for Continuous Delivery at Pluralsight
Software Craftsmanship and Agile Code Games
Thinking in F#
Transformation Priority Premise: TDD Test Order Matters
Power of Patterns: Refactoring to (or away from) Patterns
Code Katas Spring 2012
FizzBuzz Guided Kata
Bowling Game Kata in C# Adapted
Code Katas: Practicing Your Craft
Software Craftsmanship
Using Rhino Mocks for Effective Unit Testing

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
1. Introduction to Computer Programming.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation theory and applications.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Approach and Philosophy of On baking technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
A Presentation on Artificial Intelligence
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
Tartificialntelligence_presentation.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
20250228 LYD VKU AI Blended-Learning.pptx
Big Data Technologies - Introduction.pptx
Empathic Computing: Creating Shared Understanding
1. Introduction to Computer Programming.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation theory and applications.pdf
cuic standard and advanced reporting.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
The Rise and Fall of 3GPP – Time for a Sabbatical?
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Approach and Philosophy of On baking technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
A Presentation on Artificial Intelligence
Agricultural_Statistics_at_a_Glance_2022_0.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
Tartificialntelligence_presentation.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Profit Center Accounting in SAP S/4HANA, S4F28 Col11

Linq (from the inside)

  • 1. Linq (from the inside) Reinventing the Linq to Objects wheel Mike Clement mike@softwareontheside.com @mdclement
  • 7. LINQ to Amazon LINQ to Metaweb(freebase) LINQ to Active Directory LINQ to MySQL, Oracle and LINQ to Bindable Sources (SyncLINQ) PostgreSql (DbLinq) LINQ to C# project LINQ to NCover LINQ to Continuous Data (CLinq) LINQ to Opf3 LINQ to CRM LINQ to Parallel (PLINQ) LINQ To Geo - Language Integrated Query for LINQ to RDF Files Geospatial Data LINQ to Sharepoint LINQ to Excel LINQ to SimpleDB LINQ to Expressions (MetaLinq) LINQ to Streams LINQ Extender (Toolkit for building LINQ LINQ to Twitter Providers) LINQ to WebQueries LINQ to Flickr LINQ to WMI LINQ to Google http://tomasp.net/blog/linq- LINQ to Indexes (LINQ and i40) expand.aspx LINQ to IQueryable (Matt Warren on http://tomasp.net/blog/linq-expand- Providers) update.aspx LINQ to JSON Linq To WIQL LINQ to LDAP LINQ to XtraGrid LINQ to NHibernate LINQ to JavaScript Source: LINQ to LLBLGen Pro http://blogs.msdn.com/b/charlie/archive/20 LINQ to Lucene 06/10/05/links-to-linq.aspx
  • 8. If I have seen further it is by standing on the shoulders of giants. -Sir Issac Newton
  • 10. • 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.
  • 11. • 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
  • 12. from cust in customers where cust.City == "London" select cust; customers.Where( cust => cust.City == "London");
  • 13. C# Language Features • Query Expressions • Implicitly Typed Variables • Object and Collection Initializers • Anonymous Types • Extension Methods • Lambda Expressions • Auto-implemented Properties • Iterator blocks • Generics
  • 14. Anatomy of an extension method public static void Method(this IInterface myInterface, int i)
  • 18. Learning by Doing… we’ll figure it out as we go. IMPLEMENT LINQ TO OBJECTS
  • 21. C# Language Features • Query Expressions • Implicitly Typed Variables • Object and Collection Initializers • Anonymous Types • Extension Methods • Lambda Expressions • Auto-implemented Properties • Iterator blocks • Generics
  • 22. Resources • Classification by Manner of Execution • C# Features • List of Linq Providers (and other links) • EduLinq code blog posts (from Jon Skeet) • MoreLinq (from Jon Skeet) • My Starter Project – https://github.com/mdclement/Linq--from-the- inside--Presentation-Base
  • 23. 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!
  • 24. Me • @mdclement • mike@softwareontheside.com • http://blog.softwareontheside.com • Utah Software Craftsmanship Group – https://groups.google.com/forum/#!forum/ut- software-craftsmanship – @utahsc – First Wednesday, Neumont, Room 300

Editor's Notes

  • #4: Not Link cosplay! Not that there’s anything wrong with that…
  • #5: The “other” Microsoft “link”
  • #8: Language-Integrated QueryQuery is first class citizen in languageQueries are consistent across data sourcesOne query language to rule them all
  • #9: Don’t want to get too far in without recognizing the true brains behind this presentation.
  • #10: Monster on StackOverflowWrote “C# In Depth” (excellent read… I need to pick up the second edition)Wrote the Edulinq blog posts (and project that I’m based on today)
  • #13: http://msdn.microsoft.com/en-us/library/bb882642.aspxSo back to Linq…Query Expression Syntax vs. Extension MethodsNote that given the providers, “customers” could be XML, a database, a web service…But then they split it into two different syntaxes? Syntacies?“real” linq (integrated query) only supports a subset of what the full extension methods support.
  • #14: These language features are used to implement Linq either explicitly or “from the inside”Query syntax inlinevar keywordCustomer cust = new Customer { Name = "Mike", Phone = "555-1212" };An anonymous type is constructed by the compiler and the type name is only available to the compiler. Anonymous types provide a convenient way to group a set of properties temporarily in a query result without having to define a separate named type. An extension method is a static method that can be associated with a type, so that it can be called as if it were an instance method on the type. This feature enables you to, in effect, "add" new methods to existing types without actually modifying them.A lambda expression is an inline function that uses the => operator to separate input parameters from the function body and can be converted at compile time to a delegate or an expression tree.the compiler will create a private, anonymous backing field that is not accessible except through the property getter and setter.
  • #15: Linq operators are defined as extension methods on IEnumerable<T>So it’s important that we understand the anatomy of extension methods.Extension methods are defined as static methods but are called by using instance method syntax. Their first parameter specifies which type the method operates on, and the parameter is preceded by the this modifier. Extension methods are only in scope when you explicitly import the namespace into your source code with a using directive.
  • #17: Going to pull back the curtain
  • #18: Unfortunately it may feel like this for a little bit…House in Poland
  • #21: Going to pull back the curtain
  • #22: These language features are used to implement Linq either explicitly or “from the inside”Query syntax inlinevar keywordCustomer cust = new Customer { Name = "Mike", Phone = "555-1212" };An anonymous type is constructed by the compiler and the type name is only available to the compiler. Anonymous types provide a convenient way to group a set of properties temporarily in a query result without having to define a separate named type. An extension method is a static method that can be associated with a type, so that it can be called as if it were an instance method on the type. This feature enables you to, in effect, "add" new methods to existing types without actually modifying them.A lambda expression is an inline function that uses the => operator to separate input parameters from the function body and can be converted at compile time to a delegate or an expression tree.the compiler will create a private, anonymous backing field that is not accessible except through the property getter and setter.