0

I'm using Visual Studios 2015.

I'd like to see where a class object is declared and defined in my code.
E.g. Where are statements like myClass object1;?

Also, is there a way to use the find all references tool on a class method and not see other classes' methods of the same name?
E.g. We have myclass1::Run(), myclass2::Run() and perhaps a variable Run somewhere. Can I specify which kind of reference I'm looking for?

Simple questions, but I haven't been able to find the answers elsewhere.

1 Answers1

1

In Visual Studio 2019, the Find All References command should do exactly what you want. It should automatically return only the references for the particular type or member that you selected, not other symbols that happen to have the same name.

To be clear, the way I use the Find All References command does not involve the Solution Explorer. Rather, I select the name in the code editor, right-click and choose Find All References (or press a keyboard shortcut, usually F4). That approach works in VS 2015, 2017, and 2019, etc. However, the results window changed drastically from VS 2015 to VS 2017 and newer.

Scott Hutchinson
  • 1,703
  • 12
  • 22
  • I'm using Visual Studio 2015, perhaps it is not possible in VS15 – StephBoyardee Dec 30 '20 at 18:08
  • Ah, I was wondering. In VS 2015, you can filter the results to show only confirmed references, which should do what you want. – Scott Hutchinson Dec 30 '20 at 18:09
  • It appears that the filter is only available as of VS 2017, but thanks! There are however arrow buttons at the top of the VS2015 find all references window to hop between confirmed references. https://devblogs.microsoft.com/cppblog/find-all-references-re-designed-for-larger-searches/ – StephBoyardee Dec 30 '20 at 19:05
  • Oh yeah. Sorry. I forgot about that. That was a pretty horrible design. I hated having to use those arrow buttons all the time. – Scott Hutchinson Dec 30 '20 at 19:45