Debugging is like being the detective in a crime movie where you are also the murderer.
In order to debug well, we need to know the value of the current variable. In Visual Studio, this could be acquired through multiple ways. Here are some of them:
The auto window simply returns the variables 3 lines behind and 1 line in front of the current line. Sometimes the lines vary:
The local window returns all the variables in the current method. If a value is changed, it is highlighted in red:
The watch window starts without any variables in it, but these could be added, either by manually writing them or by selecting the variable in the code and with the mouse menu clicking “Add to Watch”. Additionally, whole methods could be evaluated there, with parameters taken from the code as in the example NPlusCounter: