SRA
SRA

Reputation: 1691

Find out where a variable is initialized

I have a class with variable “test” in my project. I need to find out at which page of the project/solution this “test” get initialized. Do we have any short cut keys for this, other than Ctl+F and look for entire project.

Upvotes: 6

Views: 1691

Answers (4)

AmiteshP
AmiteshP

Reputation: 1

We can use the below regex to find variable which are initialized.

Example

int var = 10;
(?:\w+\s+)([a-zA-Z])+\s(\=)

Upvotes: 0

Joel Rondeau
Joel Rondeau

Reputation: 7586

Very similar to @George's answer, but I prefer a Ctrl+Shift+F (Find In Files). Does about the same thing as Find All References, but doesn't have to compile anything to do it.

As for specifically looking for the initialization, a find in files of text:b*= (making sure Use Regular expressions is on), would find any place where you assigned to text.

This is assuming you didn't mean Ctrl+Shift+F in your question.

Upvotes: 2

George Duckett
George Duckett

Reputation: 32428

You can right-click it, then Find All References, looking for = new, or if you prefer, Ctrl-K, R.

Upvotes: 4

DanDan
DanDan

Reputation: 10562

try F12. There are some great shortcut posters here, print one out for your wall

Visual Studio 2010 Keybinding Posters

Upvotes: 7

Related Questions