147

I've been using ReSharper for a while now and sometimes it suggests that I invert the if. I guess an example would be a better explanation of my situation:

public void myfunction(int exampleParam){
    if(exampleParam > 0){
        //Do something with form controls for example.
    }
}

Now ReSharper suggests that I invert the if to this:

public void myfunction(int exampleParam){
    if(exampleParam <= 0)
        return;
    //Do something with form controls for example
}

Does this "improve" performance somehow? Or is it just aesthetic?

Dexters
  • 2,419
  • 6
  • 37
  • 57
Nasreddine
  • 36,610
  • 17
  • 75
  • 94

0 Answers0