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:
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.
精彩评论