Replace all `! Stuffs.IsEmpty () 'on' stuffs.Any () 'with ReSharper

I am working on an application where we are using an extension IEnumerable

:

public static bool IsEmpty<TSource>([NoEnumeration] this IEnumerable<TSource> source)
{
    return !source.Any(); // not actual implementation
}

      

But a lot of use looks like this:

var notEmpty = !stuffs.IsEmpty()

      

And here I got a double (and useless) negation.

I would like to automatically recalculate all this usage like this:

var notEmpty = stuffs.Any()

      

What's the easiest way to do this? with ReSharper?

+3


source to share


1 answer


Yes, you can do this using ReSharper's Structured Find and Replace . You can even save a template (in team-wide settings) to create a custom highlight in the editor (go to Options | Code Review, Custom Templates).



R # SSR

+5


source







All Articles