views:

7

answers:

1

Hi,

Is it possible in VS -maybe by using Resharper- to find a method's usage which has some of its parameters NOT set as NULL.

Imagine I have this method:

public string MyMethod(ParameterClass param1, ParameterClass param2
, ParameterClass param3,ParameterClass param4)
{

 // Some processes
 return "Hello Pandora!";

}

and I want to find its usages where param3 is not NULL.

So that it I can find the MyMethod's usages that are like:

MeyMethod(p1,p2,null,p4);

A: 

With ReSharper 5, you can search for structured pattern of something like MyMethod($p1$, $p2$, null, $p4$) where all $p...$ are expressions. Or, if you need also to track pass-through values, e.g. calling method OtherMethod(null) which passes its parameter as 3rd parameter to MyMethod, you can use Value Tracking.

Ilya Ryzhenkov