how to see the values of static variables at runtime in visual studio
One way is to use Immediate Window
as @Alexei says.
Second way is to use QuickWatch
window as below:
Put a breakpoint in the class for which you want to evaluate static or any other variables/fields/properties and run the application.
Then when the breakpoint is hit, right click on any variable/field/property in a class and select QuickWatch
. Now, type <ClassName.StaticVarName
> in the QuickWatch window textbox and press enter and you should be able to see the value as below screenshot displays:
Debug -> Windows -> Immediate -> type code to access your members:
[>] MyClass.MyStaticValue [ENTER]
Or put them in Watch window.
Notes:
- more information can be found on MSDN - Immediate Window
- you may need to use
global::
prefix if your class not found by just providing namespace (global::MyClass.MyStaticValue
).