S
S
sSmok2014-06-18 13:31:54
.NET
sSmok, 2014-06-18 13:31:54

Why are expression trees needed?

Hello.
How expression trees are used in practice in C#. Should a novice programmer delve into this topic?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Fedotov, 2014-06-18
@sSmok

An expression tree is a representation, for example, "a+b>0" not as executable code, but as data, as an object model. Why is this needed? The most common use of DVs is in the context of, for example, databases or any other consumer that needs a string that might be sent over the network. For example, an SQL query is built from the object model (a binary expression tree) (roughly speaking, something like SELECT xxx WHERE a+b>0) and sent to the server. Or this object model is passed to a method that builds a request to Google according to all the rules along the tree (a string that is then sent via http).

D
DjoNIK, 2014-06-18
@DjoNIK

A beginner doesn't really need to go deep. Familiarize yourself with what it is and try to understand it is always good.
Used by the environment itself to build LINQ expressions. In practice, to build lambda expressions. Here is a good article on the subject.

A
Alexey Kulakov, 2014-06-18
@carbon88

Beginning programmer in what area? If the web, then I think you should not go deep, at least it will not be urgent. But if the area intersects with the translation, for example, from the same Linq to something else, for example, in a SQL query, then I think it's worth reading.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question