SlideShare a Scribd company logo
Introduction of Lambda
Expression and Predicate
Builder
Bryan lin
2014/03/07
Agenda
• Lambda Expression
• PredicateBuilder
• Implementation of PredicateBuilder
Lambda expression
• What is a Lambda Expression?
• A lambda expression is an anonymous function and it is mostly used to create
delegates in LINQ. Simply put, it's a method without a declaration, i.e., access
modifier, return value declaration, and name.
Lambda expression
• Why do we need lambda expressions? (Why would we need to write a
method without a name?)
• Convenience. It's a shorthand that allows you to write a method in the same
place you are going to use it. Especially useful in places where a method is
being used only once, and the method definition is short. It saves you the effort
of declaring and writing a separate method to the containing class.
Lambda expression
• Benefits:
• Reduced typing. No need to specify the name of the function, its return type, and
its access modifier.
• When reading the code you don't need to look elsewhere for the method's
definition.
Lambda expression
• Lambda expressions should be short. A complex definition makes the
calling code difficult to read.
Lambda expression
• How do we define a lambda expression?
• Lambda basic definition: Parameters => Executed code.
PredicateBuilder
• Background
• Dynamic Predicate Construction
• You allow the user to pick, from a check box list, any of the fields that will be included
in the query, and to specify the criteria
PredicateBuilder
PredicateBuilder
• Background
• Dynamic Predicate Construction
• You can do a bunch of switch-ing if logic to figure out what kind of query to render by
adding a piece of it at a time
• Or you can use lambdas and the PredicateBuilder to inject multiple predicates into
an expression tree
PredicateBuilder
• Using the Code
• To combine the two criteria below:
PredicateBuilder
• Using the Code
• Do with the PredcateBuilder:
PredicateBuilder
• Using the Code
• And then:
Implementation of PredicateBuilder
• Implmentation of and logic:
Implementation of PredicateBuilder
• Implementation of or logic:
References
• http://www.codeproject.com/Tips/298963/Understand-Lambda-
Expressions-in-3-minutes
• http://www.codeproject.com/Articles/28580/LINQ-and-Dynamic-
Predicate-Construction-at-Runtime
• http://www.albahari.com/nutshell/predicatebuilder.aspx
FAQ

More Related Content

PDF
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
PDF
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02)
PPT
Lambdas
PPT
JAZOON'13 - Oliver Zeigermann - Typed JavaScript with TypeScript
PPTX
Js syntax
PPTX
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
PDF
Python's dynamic nature (rough slides, November 2004)
PDF
MongoDB World 2018: A Swift Introduction to Swift
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02)
Lambdas
JAZOON'13 - Oliver Zeigermann - Typed JavaScript with TypeScript
Js syntax
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
Python's dynamic nature (rough slides, November 2004)
MongoDB World 2018: A Swift Introduction to Swift

What's hot (20)

PDF
Xtend - better java with -less- noise
PDF
Jazoon2013 type script
PPSX
VBScript in Software Testing
PPTX
Programming Paradigm & Languages
PPTX
C# basics...
PPTX
Scala-Ls1
PDF
Variables in Pharo5
PDF
Intro to JavaScript - Thinkful LA, June 2017
PPTX
Agile korea 2013 유석문
PPTX
Overview of CoffeeScript
PDF
Crafting high quality code
PDF
Thinkful - Intro to JavaScript
PPTX
Fp and scala
PPS
Few minutes To better Code - Refactoring
PPTX
.Net programming with C#
PDF
Api and Fluency
PDF
Kotlin & arrow: the functional way
PPTX
Learn Java in 2 days
PPTX
Cucumber_Training_ForQA
PPTX
Being Lean Agile
Xtend - better java with -less- noise
Jazoon2013 type script
VBScript in Software Testing
Programming Paradigm & Languages
C# basics...
Scala-Ls1
Variables in Pharo5
Intro to JavaScript - Thinkful LA, June 2017
Agile korea 2013 유석문
Overview of CoffeeScript
Crafting high quality code
Thinkful - Intro to JavaScript
Fp and scala
Few minutes To better Code - Refactoring
.Net programming with C#
Api and Fluency
Kotlin & arrow: the functional way
Learn Java in 2 days
Cucumber_Training_ForQA
Being Lean Agile
Ad

Similar to Introduction of lambda expression and predicate builder (20)

PPTX
PPTX
Peeling back the Lambda layers
PPTX
Ch-4 Middleware Architectures.pptx
PPT
20130329 introduction to linq
PPTX
Lambda Expressions Java 8 Features usage
PPTX
Understanding LINQ in C#
PPTX
Lecture 5 Functions all about business categories
PDF
Serverless Microservice Patterns for AWS
PDF
What's a macro?: Learning by Examples
PPTX
Functional Interfaces and Method References.pptx
PDF
SOA with Zend Framework
PDF
Lambdas in Java 8
PDF
Lambdaless and AWS CDK
PDF
What is Python Lambda Function? Python Tutorial | Edureka
PDF
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
PPTX
Building Better AWS Lambdas: Unlocking the Power of Layers
PPT
C#3.0 & Vb 9.0 New Features
PDF
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
PDF
Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Peeling back the Lambda layers
Ch-4 Middleware Architectures.pptx
20130329 introduction to linq
Lambda Expressions Java 8 Features usage
Understanding LINQ in C#
Lecture 5 Functions all about business categories
Serverless Microservice Patterns for AWS
What's a macro?: Learning by Examples
Functional Interfaces and Method References.pptx
SOA with Zend Framework
Lambdas in Java 8
Lambdaless and AWS CDK
What is Python Lambda Function? Python Tutorial | Edureka
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
Building Better AWS Lambdas: Unlocking the Power of Layers
C#3.0 & Vb 9.0 New Features
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...
Aws Lambda for Java Architects - Illinois VJug -2016-05-03
Ad

More from LearningTech (20)

PPTX
PPTX
PostCss
PPTX
ReactJs
PPTX
Docker
PPTX
Semantic ui
PPTX
node.js errors
PPTX
Process control nodejs
PPTX
Expression tree
PPTX
SQL 效能調校
PPTX
flexbox report
PPTX
Vic weekly learning_20160504
PPTX
Reflection & activator
PPTX
Peggy markdown
PPTX
Node child process
PPTX
20160415ken.lee
PPTX
Peggy elasticsearch應用
PPTX
Expression tree
PPTX
Vic weekly learning_20160325
PPTX
D3js learning tips
PPTX
git command
PostCss
ReactJs
Docker
Semantic ui
node.js errors
Process control nodejs
Expression tree
SQL 效能調校
flexbox report
Vic weekly learning_20160504
Reflection & activator
Peggy markdown
Node child process
20160415ken.lee
Peggy elasticsearch應用
Expression tree
Vic weekly learning_20160325
D3js learning tips
git command

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Approach and Philosophy of On baking technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
KodekX | Application Modernization Development
PPTX
Spectroscopy.pptx food analysis technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Review of recent advances in non-invasive hemoglobin estimation
Understanding_Digital_Forensics_Presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Diabetes mellitus diagnosis method based random forest with bat algorithm
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Approach and Philosophy of On baking technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx
The AUB Centre for AI in Media Proposal.docx
MIND Revenue Release Quarter 2 2025 Press Release
KodekX | Application Modernization Development
Spectroscopy.pptx food analysis technology
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
Reach Out and Touch Someone: Haptics and Empathic Computing
Digital-Transformation-Roadmap-for-Companies.pptx
MYSQL Presentation for SQL database connectivity
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Introduction of lambda expression and predicate builder