Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReSharper: Find Usages of an optional parameter

If I have a function with optional parameter, is there an easy way to find all the locations in my code that call that function and pass a value to that parameter?

The function has many non-default parameters, so scanning the usual Find Usages results of places that call the function is problematic, as it trims the lines and I can't see if the optional parameter is used.

like image 592
splintor Avatar asked Aug 29 '13 08:08

splintor


2 Answers

With your cursor on the parameter, choose ReSharper | Inspect | Value Origin, or from the keyboard, Inspect This with Ctrl+Shift+Alt+A, then Value Origin.

You will get an Inspection Results window with all the places that explicitly assign that parameter a value.

like image 173
AakashM Avatar answered Oct 20 '22 18:10

AakashM


I think the best way is changing Signature of the method. In other word you can change type of the parameter to another type (that is not used by parameters for safety) and see Errors list after rebuild. By this way you can find all (not only explicitly) usages of the parameter.

like image 38
Guido Mocha Avatar answered Oct 20 '22 19:10

Guido Mocha