开发者

How to find a "method usage" all along a VS solution by specifying its parameters that are not NULL?

开发者 https://www.devze.com 2023-01-04 08:53 出处:网络
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.

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,Para开发者_如何学运维meterClass 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);


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号