什么是最大的LINQ表达式树可以做什么? [英] What is the max LINQ Expression Trees can do?

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

问题描述

什么是maximun的LINQ表达式树可以做什么?



可不可以这样定义一个类?
怎么样的方法,所有的声明的名称,修饰符,参数类型和返回类型?



必须程序总是定义树本人呢?是否有可能从给定的C#文件树?



我在哪里可以得到资源,了解写作基础到高级表达式树和表达式树访客? (文章和视频将是伟大的)

对于那些谁能够帮助...




谢谢解决方案

在C#3,表达式树可以代表的表达式的。故名。并且它们进一步限制到C#表达式的一个子集 - 不赋值表达式,没有涉及到指针类型,等等表达式



在库,将用C#运送4,我们延长了表达式树的的也支持声明的树木。然而,C#4不会自动一份声明中,拉姆达翻译成语句树。



这是一个明显的和有用的功能,我们根本没有时间去为C#4,我们会考虑为未来的假想版本。如果您有说法树一个真正伟大的用户场景,我很乐意听到这种说法。



最明显的进一步延伸到所有的声明树,这将是一流的声明结构声明,等等。拥有的总同像性的C#语言和表达式树库之间将是真棒。它将使各种有趣的元编程场景。但是,这不会发生任何时间很快,所以不要让你的希望。这是更多的矿山可能永远不会发生的一个长期的梦想。


What is the maximun that LINQ expression Tree can do?

Can it define a class? How about a method, with all the declared name, modifiers, parametertype and return type?

Must the program always define the tree himself? Is it possible to generate the tree from a given C# file?

Where can I get resources to learn about writing basic to advanced Expression Tree and Expression Tree Visitor? (articles and videos will be great)

Thanks for those who are able to help...

解决方案

In C# 3, expression trees can represent expressions. Hence the name. And they are further restricted to a subset of C# expressions -- no assignment expressions, no expressions involving pointer types, and so on.

In the libraries that will ship with C# 4, we have extended the expression tree library to also support statement trees. However, C# 4 will NOT automatically translate a statement-lambda into a "statement tree".

That is an obvious and useful feature which we simply did not have time to get to for C# 4. We'll consider it for hypothetical future versions. If you have a really great user scenario for statement trees, I'd love to hear it.

The obvious further extension to all that is declaration trees, which would represent class declarations, struct declarations, and so on. Having total homoiconicity between the C# language and the expression tree library would be awesome. It would enable all kinds of interesting metaprogramming scenarios. But that will not happen any time soon, so do not get your hopes up. That's more of a long-term dream of mine which might never happen.

这篇关于什么是最大的LINQ表达式树可以做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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