Last post Jan 11, 2016 07:45 PM by gerrylowry
Jan 11, 2016 06:38 PM|sudip_inn|LINK
i just read a article on Expression tree from this site
still not very clear to me the advantage or real usage of Expression tree.
i like to know Expression tree is related to lamda ?
anyone can discuss with sample code when one should use Expression tree in c# code. show few real life example. thanks
Jan 11, 2016 07:45 PM|gerrylowry|LINK
this, many questions that you've asked before, and many questions that you will ask in the future are answered in detail in Jon Skeet's excellent book:
C# in Depth, Third Edition
Foreword by Eric Lippert
September 2013 ISBN 9781617291340 616 pages printed in black & white
CHAPTER 9 LAMBDA EXPRESSIONS AND
Note: if you are a member of ACM, your membership allows you to read this book and 100's of others for free on-line.
Short version answer, quoting Jon Skeet:
"One of the fundamental building blocks of LINQ is the ability
to create pipelines of operations, along with any state required
by those operations. These operations can express all kinds
of logic about data: how to filter it, how to order it, how to join
different data sources together, and much more.
When LINQ queries are executed inprocess, those operations are
usually represented by delegates.
the C# compiler can also transform them into expression trees—data
structures representing the logic of the lambda expressions—so
that other code can examine it. In short, lambda expressions are
the idiomatic way of representing the operations in LINQ data pipelines ..."