Hiding private fields without using attributes
There are two problems with [Debu开发者_高级运维ggerBrowsable]
. First, it needs to be on all your fields. And second, if your using auto properties, you don't have fields.
Is there any way to (temporarily) get the debugger to only show public properties, or atleast hide the auto-generated backing field of c#'s auto properties? I'm probably dreaming, but maybe even group them like the class diagram tool?
Not sure why you'd want to do this, allowing the debugger to peek at your private parts can be pretty important while debugging. Short from overriding the ToString() method, consider using the [DebuggerVisualizer] attribute instead. Quite handy to present a birds-eye view of the object state and still allowing to drill in to the privates when you need to.
精彩评论