Visual Studio调试“快速观察”工具和lambda表达式 [英] Visual Studio debugging "quick watch" tool and lambda expressions

查看:222
本文介绍了Visual Studio调试“快速观察”工具和lambda表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在快速观察窗口中调试时不能使用lambda表达式?

Why can't I use lambda expressions while debugging in "Quick watch" window?

UPD:另请参见

http://blogs.msdn.com/b/jaredpar/archive/2009/08/26/why-no-linq-in-debugger-windows.aspx

http://blogs.msdn.com/b/jaredpar/archive/2010/06/02/why-is-linq-absent-from-debugger-windows-part-2。 aspx

推荐答案

Lambda表达式,像匿名方法,实际上是非常复杂的野兽。即使我们排除了表达式(.NET 3.5),仍然留下了一个复杂的批次,而不是被捕获的变量,构造使用它们的代码(你认为变量变成编译器生成的类的字段),有一点烟雾和镜像。

Lambda expressions, like anonymous methods, are actually very complex beasts. Even if we rule out Expression (.NET 3.5), that still leaves a lot of complexity, not least being captured variables, which fundamentally re-structure the code that uses them (what you think of as variables become fields on compiler-generated classes), with a bit of smoke and mirrors.

因此, m不是最不惊讶的是你不能空闲使用它们 - 有一个支持这种魔法的编译器工作(和幕后类型生成)的批次

As such, I'm not in the least surprised that you can't use them idly - there is a lot of compiler work (and type generation behind the scenes) that supports this magic.

这篇关于Visual Studio调试“快速观察”工具和lambda表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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