什么是一些实例中,表达式树是有用的? [英] What are some instances in which expression trees are useful?

查看:99
本文介绍了什么是一些实例中,表达式树是有用的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全理解表达式树的概念,但我有一个很难试图找到他们是有用的情况。有没有在表达式目录树可应用于特定的实例?或者是它只是作为一种传输机制代码有用吗?我觉得我失去了一些东西。谢谢!


解决方案

或者它只是作为一种传输机制代码?

有用


这是代码是一个有用的的执行机制的。使用解释格式,表达式树可以直接解释。因为它是非常容易和快速实施,这非常有用。这样的解释是无处不在,甚至在似乎并不理解什么情况下使用,例如打印嵌套结构。


I completely understand the concept of expression trees, but I am having a hard time trying to find situations in which they are useful. Is there a specific instance in which expression trees can be applied? Or is it only useful as a transport mechanism for code? I feel like I am missing something here. Thanks!

解决方案

Or is it only useful as a transport mechanism for code?

It's useful as an execution mechanism for code. Using the interpreter pattern, expression trees can directly be interpreted. This is useful because it's very easy and fast to implement. Such interpreters are ubiquitous and used even in cases that don't seem to "interpret" anything, e.g. for printing nested structures.

这篇关于什么是一些实例中,表达式树是有用的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆