开发者

Hide null members in Visual Studio watch window

How can开发者_如何学Python I hide null members in watch screen? I don't need that.

Below is an screenshot:

Hide null members in Visual Studio watch window


It doesn't work that way. The inspector is there for you to see all available members. The visibility of the members never has anything to do with the value of the member, null or otherwise. Conceivably you might be able to write a plugin that replaces the inspector in its entirety, to do what you want, but that would be a lot of work.


You can override the ToString on the class to display something that's useful to you. If you don't want to that your best bet might be to use the DebuggerDisplayAttribute attribute to create a DebuggerToString that can be used in the debugger. Have a look at this (MSDN) Enhancing Debugging with the Debugger Display Attributes or (blog) Why override ToString()? Use DebuggerDisplayAttribute instead

You would do this at the class level on your GDicStruct rather than on the properties.

So you could add

[DebuggerDisplayAttribute("{DebuggerToString}")]
public struct GDicStruct
{
    public string DebuggerToString()
    {
        //logic to create debugger string
    }
}

but you have to ask if it's worth the effort.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜