我正在使用一个IEnumerable,但在调试器中我希望能看到它所包含的项,但是因为没有任何属性或items,我无法做到。
有可能查看IEnumerable中包含的项吗?
我正在使用一个IEnumerable,但在调试器中我希望能看到它所包含的项,但是因为没有任何属性或items,我无法做到。
有可能查看IEnumerable中包含的项吗?
按照以下指示操作:
即点击被突出显示区域左侧的那些圆形箭头。
调试时,设置断点,然后在VS中转到:
调试 -> 窗口 -> 快速窗口
,然后在快速窗口中输入以下命令:
yourEnumerable.ToList()
yourEnumerable.Count() // see how many elements are in
yourEnumerable.ToList()[0] // access by index
yourEnumerable.ToArray()[0] // also access by index
.ToList();
// and access single elements through the index
.ToList()[0];
//you can use type those commands in the table at
//"observe local"