Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a (better) way to find all references to a property setter?

Visual Studio's "Find All References" function works nicely for finding references to a property, and as it happens the "Call Hierarchy" does this too - it's even better in fact, as it sorts them by calling method.

My problem however is that neither of these methods discriminate between the setter and getter, and so I'm reduced to using find-in-files for "PropertyName =".

That seems like a step backwards (and would obviously not find code using "PropertyName += value" or similar), so I was wondering if I'd missed a simple way of persuading the "Call Hierarchy" function of Visual Studio to work on a property setter or getter specifically?

like image 636
Ben Avatar asked May 12 '11 16:05

Ben


1 Answers

Resharper can do that for you.

Without R#, one way would be to temporarly set the setter to private and recompile. That will give an error everywhere you're trying to set. Not pretty, but faster than any other method I can think of.

like image 178
Andy Avatar answered Oct 11 '22 07:10

Andy