在Visual Studio的Watch窗口中,Flatten继承成员? [英] Flatten inherited members in Visual Studio's Watch window?

查看:166
本文介绍了在Visual Studio的Watch窗口中,Flatten继承成员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让Watch窗口在一个长的平面列表中显示所有继承的属性和字段,而不是隐藏在嵌套的base节点之后?



我正在调试一些大量使用继承的C#代码 - 我想观看的一些属性在Watch窗口中位于三个层次的base之后。如果我只想检查一个这样的对象,那么这个或多或少是可以承受的,但我实际上正在看一棵树...

解决方案

请参阅是持久化的,并将在您从该时刻在DataTip或QuickWatch窗口中查看该类型的对象时显示,因此下一次您的变量类型,你不需要扩展它们基节点。并且,由于已加星号的值显示为父节点的文本,如果您正在查看这些大量嵌套对象的树数据结构(正如您所说的那样),您将能够看到这些属性,甚至根本不会扩展节点。 / p>

全面披露:我是这里描述的工具的合着者。


Is there some way to make the Watch window display all inherited properties and fields in one long flat list, rather than hidden behind a nested "base" node?

I'm debugging some C# code that makes massive use of inheritance - some of the properties I want to watch are behind three levels of "base" in the Watch window. This would be more or less bearable if I just wanted to examine a single such object, but I'm actually looking at a tree of them...

解决方案

see http://blogs.msdn.com/b/jaredpar/archive/2010/02/19/flattening-class-hierarchies-when-debugging-c.aspx

UPDATE: I wrote a commercial tool called OzCode that solves this problem. The idea is that if you're interested in a property of the base class, you can "Star" that property, which causes the property to appear at the top of members list, and also in the text of its parent.

So for example, in the following scenario, I had to expand two base nodes to get to see the properties I wanted, "Important" and "Interesting":

But once I star these properties, they will always appear at the top, even when viewing variables of the Derived type, so I'll see:

These stars are persisted and will be shown whenever you view a an object of that type in the DataTip or QuickWatch window from that moment on, so the next time you a variable of that type, you won't need to expand those "base" nodes. And because starred values appear as the parent node's text, if you're looking at a tree datastructure of these heavily nested objects (as you stated you were), you will be able to see these properties without even expanding the nodes at all.

FULL DISCLOSURE: I'm the co-author of the tool I've described here.

这篇关于在Visual Studio的Watch窗口中,Flatten继承成员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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