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 ha开发者_StackOverflow社区ppens 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?
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.
It is possible in Visual Studio 2019 to sort and filter by "Kind" using the "Find All References" function. The feature was requested on Microsoft's developercommunity forum
The "references" window with the "Kind" column is displayed to the very right, highlighted by a orange box.
精彩评论