I know that you can either step into every pro开发者_如何学JAVAperty or not step into every property, but I would really like to be able to step into a specific property, and not the rest. Is this possible? (I also know I can use keyboard commands, but I'm asking if there's a more permanent solution.) I have a lot of properties and my setters do important things, so it's silly to step over them, but most of my getters are pointless. I'm looking for something like:
public string ImportantProperty
{
get { return _importantProperty; }
[DebuggerStepThrough(false)]
set
{
if (this.State != ConnectionState.Closed)
throw new InvalidOperationException(
"Important Property cannot be changed unless This is closed.");
if (ImportantProperty == value)
return;
_importantProperty = value;
OnImportantPropertyChanged(new EventArgs());
}
}
Unfortunately, I can't find anything that will act like [DebuggerStepThrough(false)]
and I must resort to turning off property step-over and putting [DebuggerStepThrough]
everywhere I don't want to step-through.
Microsoft has information published for how to do this in Visual Studio 2010 and 2008. These techniques work fine in Visual Studio 2012.
How to: Step Into Properties and Operators in Managed Code
Read through all of the steps if you want, or just edit the Tools > Options using the screen capture below (check or uncheck that one item):
Where is this useful?
If you uncheck the item Step over properties and operators (Managed only), then F11 will step into a property or method. F10 will step over it.
Why don't you put breakpoints in properties' setters of interest only and press F5 to run till the next breakpoint?
Why don't you step-over unimportant properties -at setting them- by pressing shift+F11?
精彩评论