.NET Tips and Tricks

Blog archive

Finding Where a Method, Property, or Variable Is Used

I think everybody knows that if you click on a variable, method, or property name and press F12 (or select Go To Definition from the pop-up menu) you'll be taken to the method or property's code or to the variable's declaration. But sometimes you want to see the reverse: All the places where a property, method, or variable is being used -- and not everyone seems to know about that.

That's too bad because it's a cool feature of Visual Studio: Just click on a method (or property or variable), press Shift+F12 (or select Find All References) and Visual Studio opens a new window below the editor window, listing all the places where the method is used. If you double-click on one of the items in the list, you'll be taken to the code. With that list, therefore, you can step through all the places in your application that you might want to look at to understand how the method is used (the definition of the method appears at the top of the list, by the way, so you can go there, also).

The Window stays visible until you close it or do something that moves another window in the group to the top (building your application pops the output window over the list, for example). The Window is still there if you want to go back to it, however: It's called Find Symbol Results.

Posted by Peter Vogel on 12/04/2014

comments powered by Disqus


Subscribe on YouTube