观察窗口与代码

时间:2017-05-18 09:15:11

标签: c# visual-studio casting

在我的代码中:

List<int> x = new List<int>();
IEnumerable<object> y = x as IEnumerable<object>;

和y为null,但在Visual Studio的监视和即时窗口中它(2015 Professional和2017 Community)。是什么给了什么?

1 个答案:

答案 0 :(得分:3)

这听起来像是表达式求值程序中的一个可能错误 - 如果在“调试选项”中选中“使用旧表达式求值程序”,则“监视”窗口会正常运行。

enter image description here

enter image description here