how to see the values of static variables at runtime in visual studio

Victor Mukherjee picture Victor Mukherjee · Feb 14, 2013 · Viewed 15.5k times · Source

The question pretty much explains what I want to do. I have several projects in c# which constitute the solution and I want to view the values of static variables at runtime in visual studio. Is there a way to do that?

Answer

Alexei Levenkov picture Alexei Levenkov · Feb 14, 2013

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).