tanascius
tanascius

Reputation: 53944

Is there a VS shortcut to see the class definition of a variable?

When I press Ctrl+Left mouse button or F12 on a variable I get to the declaration of the variable.

Is there a shortcut like this to get to the class definition of the variable's type? So when I have a variable string functionCode I'd like to click functionCode anywhere in the program and get straight to the object browser showing me the string class.

Of course, this is most useful for self-defined classes and member variables. Sometimes I do not see the type of a member in a method at all - everywhere just var. To get to a class definition I have to go to the variable definition and from there to the class definition.

OK, this is all about saving one click ... but I am lazy ... is it possible?

PS: ReSharper solutions are welcome, too.

Upvotes: 8

Views: 9101

Answers (2)

ChrisBD
ChrisBD

Reputation: 9209

The best way is by use of a mix between the code page and the Code Definition Window : Ctrl+W,D.

You can click on the item in code and view it in the Code Definition Window, then click on the base class in the code definition window and by using F12 it will take your code page to the base class definition.

Upvotes: 5

tanascius
tanascius

Reputation: 53944

I just realized that is is possible to click Ctrl+Left mouse button or to press F12 on the var-keyword, too ...

Upvotes: 3

Related Questions