I have read the following: https://stackoverflow.com/a/20766203/10046099
What I don't get is this part:
Expression trees were created in order to make the task of converting code such as a query expression into a string that can be passed to some other process and executed there. It is that simple.
If we got query expression, why can't it directly transform it into sql string that gets sent to sql database? Why is tree necessary? Because what happens is instead of directly transforming query expression into sql string, it first transforms it into tree and then transforms tree into sql string which means 2 steps instead of 1.
I'd appreciate the easiest explanation.
UPDATE
Let's look at the following linq
IEnumerable<int> scoreQuery =
from score in scores
where score > 80
select score;
Could you turn this into expression tree as a binary tree drawing? Maybe after this, it will get easier to me how expression trees then get transformed into sql string.