Mastering Visual Studio 2017
上QQ阅读APP看书,第一时间看更新

Changes to Find All References of an instance

The Find All References command in Visual Studio is not a new thing. It's used to find out all the references of a member or symbol. In earlier versions of Visual Studio, the UI of the result dialog was simple, having only the results in a grouped list. You can find the previous result dialog here:

However, there was always a demand to improve it, as most developers use it regularly to check for references of a member, type, or symbols. Microsoft worked on it in Visual Studio 2017 and have provided a rich UI for developers to improve their daily productivity.

It now has an advanced grouping, filtering, sorting, and searching within the reference result. It now also has a colorization of the term in the result, giving you a clear understanding of the references and directly moving you into the line of code that you are looking for. Here, you can see the new result dialog:

The resultant dialog lists the results in a grid, having column headers to give you clear visibility of the records, which includes the code, file name, line number, and so on for your easy reference. You can use the column headers to sort the result based on your need.

When you hover your mouse over a resultant item in the grid, a tooltip is displayed with the context of the reference in source code. This gives you a quick peek of what you are looking for.

The toolbar of the dialog has many new toolbox items. Let's understand each one of them, as follows:

  1. This list has a few entries with which you can filter the records to solution level, project level, and so on. The list consists of the following entries:
    • Entire Solution
    • Open Documents
    • Current Project
    • Current Document
    • Changed Documents
  1. This is the Copy button that copies the content of the selected record.
  2. These are the two buttons for navigation purposes. This will navigate you to the previous and next location in the list.
  3. This button is used to clear all the filters.
  4. This combination list allows you to change the Group by definition. You can choose any one of the following:
    • Project then Definition
    • Definition only
    • Definition then Project
    • Definition then Path
    • Definition, Project then Path
  1. This is another new toggle button to help you keep the current result on the screen when you trigger another Find All Reference command. When the Keep Results button is turned ON, the next invocation of Find All References will populate the reference results in a new window.
  2. The search box will allow you to search within the result set to give you the perfect result that you are looking for.