What is the best practice when having a terminate clause...see explanation :)

c#

Solution

private void MyMethod(bool arg){
   if(arg)
       return;
   //do stuff
};

(for voting)

Problem

The case goes as following: You have a Boolean property called FullScreenEnabled. You enter some method, and the code within this method is executed iff FullScreenEnabled is true. Which of the 2 approaches below do you use in your everyday programming: ``` private bool FullScreenEnabled { get; set; } // Check if FullScreenEnabled is false and return; private void Case1() { if (FullScreenEnabled == false) { return; } // code to be executed goes here! } // Surround the code by an if statement. private void Case2() { if (FullScreenEnabled) { // code to be executed goes here! } } ```

Original source