什么是深入学习C#表达式树的最佳资源? [英] What is the best resource for learning C# expression trees in depth?

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

问题描述

当我第一次键入这个问题,我这样做是为了找到重复的问题,感觉肯定有人必须已经问过这个问题。我的计划是遵循这些欺骗链接,而不是张贴了这个问题。但这个问题一直没有,据我可以看到... ...它没有在相关问题列表打开之前问。

When I first typed this question, I did so in order to find the duplicate questions, feeling sure that someone must have already asked this question. My plan was to follow those dupe links instead of posting this question. But this question has not been asked before as far as I can see ... it did not turn up in the "Related Questions" list.

什么是一些你已经找到(文章,书籍,博客等),在C#中获得表达式树的深入了解的最好的资源?我不断收到由他们的能力感到惊讶,现在我在那里我说,点OK,够惊喜。我想马上停止,并得到这些东西的博士学位。 。我在寻找有系统地,有条不紊地覆盖能力,然后通过你可以与他们做什么详细的例子散步材料

What are some of the best resources you've found (articles, books, blog posts, etc.) for gaining an in-depth understanding of Expression Trees in C#? I keep getting surprised by their capabilities, and now I'm at the point where I'm saying, "OK, enough surprise. I want to stop right now and get a PhD in these things." I'm looking for material that systematically, methodically covers the capabilities and then walks through detailed examples of what you can do with them.

请注意:我不是在谈论lambda表达式。我说的表达式来; T>和所有与它去和它产生的东西。

Note: I'm not talking about lambda expressions. I'm talking about Expression< T > and all the things that go with it and arise from it.

感谢。

推荐答案

第11章(内部表达式树)和第12章(扩展LINQ)编程Microsoft的LINQ(ISBN 13:978-0-7356-2400-9或ISBN 10:0-7356-2400-3)是非常宝贵的我。我没有读过书容斯,但他是一个人的品质,并解释了事情做好,所以我认为他的报道也将是不错的。

Chapter 11 (Inside Expression Trees) and chapter 12 (Extending Linq) of Programming Microsoft Linq (ISBN 13: 978-0-7356-2400-9 or ISBN 10: 0-7356-2400-3) has been invaluable for me. I haven't read Jons book, but he is a quality guy and explains things well, so I assume that his coverage would also be good.

另一个伟大的资源是< A HREF =htt​​p://community.bartdesmet.net/blogs/bart/archive/tags/LINQ/default.aspx>巴特迪斯的博客

另外,请在MSDN上你的眼睛,示例代码为建设简单的LINQ到数据库(由Pedram雷扎伊)即将获得约40页的DOCO解释它

Also, keep your eye on MSDN, the sample code for building a Simple Linq to Database (by Pedram Rezaei) is about to get about 40 pages of Doco explaining it.

编辑:。(我可能只是在这里不断增加资源链接随着时间的推移,因为它是这个信息有用的占位符。)

(I might just keep adding resource links here over time, as it's a useful placeholder for this info.)

有一个真正的,对于表达式树的其实真正有用的资源,我把它当成一个的必须表达式树Visualiser的的调试工具。

A really, really useful resource for Expression Tree's in fact I would regard it as a must have is the Expression Tree Visualiser debugging tool.

您也应该学习尽可能多地了解表达式树游客,有一个相当不错的基类inplementation的此处

You should also learn as much as you can about Expression Tree Visitors, there is a pretty good base class inplementation here.

下面是从访问者类派生做一些调试(我根据这在我书中提到的一些示例代码)一些示例代码prependIndent方法调用只是一个在一个字符串扩展方法,把一个 - 在每个缩进级别

Here is some sample code derived from that Visitor class to do some debugging (I based this on some sample code in the book I mentioned) the prependIndent method call is just an extension method on a string to put a "--" at each indent level.

  internal class DebugDisplayTree : ExpressionVisitor
  {
    private int indentLevel = 0;

    protected override System.Linq.Expressions.Expression Visit(Expression exp)
    {
      if (exp != null)
      {
        Trace.WriteLine(string.Format("{0} : {1} ", exp.NodeType, exp.GetType().ToString()).PrependIndent(indentLevel));
      }
      indentLevel++;
      Expression result = base.Visit(exp);
      indentLevel--;
      return result;
    }
    ...

这篇关于什么是深入学习C#表达式树的最佳资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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