本文介绍了VS2015 立即窗口中的 lambda 表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 Visual Studio 2015,其中

正如你所看到的,它给了我表达式不能包含 lambda 表达式".我查看了工具 -> 选项 -> 调试设置,但找不到与该问题相关的任何内容.我运行的版本是VS2015 Enterprise, 14.0.24720.00 Update 1什么可能导致此问题?

解决方案

这对我来说绝对有效,就像我勾选 Use Managed Compatibility ModeUse legacy C# and VB表达式求值器 它停止工作.确保未选中这些.

I am running Visual Studio 2015, where people claim that lambda expressions are supported in immediate window, watch and other places. But that does not work for me.I created a new console application with the following code:

static void Main(string[] args)
{
    var list = new List<int> {1, 2, 3, 4, 5, 6, 7};
}

And then tried some simple lambdas in immediate window and watch as can be seen here:

And as you can see, it gives me "Expression cannot contain lambda expressions".I've looked in tools -> options -> debug settings but could not find anything related to the issue.The version I am running is VS2015 Enterprise, 14.0.24720.00 Update 1What could be causing this issue?

解决方案

This definitely works for me, looks like when I tick either Use Managed Compatibility Mode or Use the legacy C# and VB expression evaluators it stops working. Ensure those are unchecked.

这篇关于VS2015 立即窗口中的 lambda 表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 19:43