Does inverting the "if" improve performance?

C#If StatementResharper

C# Problem Overview


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?

C# Solutions


Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNasreddineView Question on Stackoverflow