Finding all the places a variable has been set?

Viewed 9017

Often when developing with VS2010 Ultimate, I want to check where in a codebase a value is being set (so where this is an assignment).

Is there a way, using VS2010 Ultimate, or a 3rd party debugging tool, to be able to get all the places in a codebase where a variable has been set or got?

8 Answers

For what it's worth, this will finally be natively supported in VS2019.

Specifically the 'Find All References' window has a new 'Kind' column which can be filtered for 'Write' references:

enter image description here

The specific GitHub PR that added this feature is scheduled to be included in Visual Studio 2019 Preview 2 (16.0.P2) https://github.com/dotnet/roslyn/issues/22545

The full release of VS2019 is roadmapped for Q1 of 2019.

You can use CTRL+SHIFT+F with regular expression : MyVariable[ \t\r\n\v\f]*=[^=], this will search for the "myVariable" by left of the "=" sign .

Related