UserControl
UserControl

Reputation: 15179

How to view static class members without an instance in Visual Studio debugger?

I have an abstract class like this:

    private abstract class TBase : TRoot
    {
        internal static int c = 123;
    }

I'd like to see c value whenever I stop execution of the program (console app). If I put TBase into Watch window I get

error CS0119: 'TBase' is a type, which is not valid in the given context

Is there a way to monitor TBase.c without having an instance of TBase in VS 2015 debugger?

Update: Oh, it's just intellisense not showing c in the drop-down

Update2: What expression do I use in case of

private abstract class TBase<T, R> : TRoot

TBase<,>.c doesn't seem to work. Is it possible not to specify generic arguments?

Upvotes: 0

Views: 1139

Answers (1)

SLaks
SLaks

Reputation: 888185

The watch window accepts any valid C# expression.

You can use TBase.c

Upvotes: 4

Related Questions