'Evaluate expressions during debugging in Visual Studio

I am used to Jetbrains IDEA and Java, but now I have a project in .NET/C# and using Visual Studio 2017 (Community).

If I debug code in IDEA, I can always run code when the execution is stopped at a breakpoint using the 'Evaluate Expression' function of the IDE: https://www.jetbrains.com/help/idea/evaluating-expressions.html (Although it is for PyCharm, the Java one works the same: GIF).

Is there anything similar in Visual Studio?



Solution 1:[1]

The Visual Studio debugger includes expression evaluators that work when you enter an expression in the QuickWatch dialog box, Watch window, or Immediate window. The expression evaluators are also work in the Breakpoints window and many other places in the debugger.

Here's a link

Solution 2:[2]

Simply highlight the expression, right click and select "Evaluate in Debug Console" - it will give you the result in the DEBUG CONSOLE

Solution 3:[3]

The closest I could find for the "Quick Evaluate Expression" from IntelliJ in Visual Studio is the "Quick Watch" tool.

You can either select your variable/expression and use the shortcut

  • Ctrl + D and then press Q

or use the context menu, right-click and hit "Quick Watch".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Jaw
Solution 3 YanMax