Search code examples
visual-studiobreakpoints

Setting a breakpoint in the middle of a line with multiple statements


I want to have a single line of code with an if and the result on the same line. Example

    if(_count > 0) return;

If I add a breakpoint on the line, it is set on the if(_count > 0):

Breakpoint on the if statement

but what I want is to have the breakpoint on the return; like so:

Breakpoint on return

Is this doable?

NOTE: The closest question I could find on SO was this (which is not the same thing).


Solution

  • Just click on a part of the line and press F9. This will set breakpoint in the middle of the line.