title: c# how to 'return if not null' in a one liner?
body: <p>Is there a one liner to return something if it not null or continue execution, or how to make such thing?
  All this to avoid copy pasta the IF lines in several methods.</p>
  
  <p>Initial code would be this:</p>
  
  <pre><code>var error = ValidateStuff(someArg);
  if (error != null)
  {
      return error;
  }
  DoOtherStuff();
  </code></pre>
  
  <p>So how to refactor it in order to avoid copy pasting that same if everywhere?
  Pseudo code would be something like</p>
  
  <pre><code>ValidateStuff(someArg) ? return ___ : continue;
  DoSomethingElse();
  AndMoreStuff();
  </code></pre>
  
  <p>-EDIT-
  An even more simplistic example, in order to clear some doubts going on in some answers and comments:</p>
  
  <pre><code>public string Foo(string arg)
  {
      string fuu = GetMeSomething(arg);
  
      if(fuu != null) return fuu;
  
      ImDoingThings();
  
      return "I did things";
  }
  </code></pre>
  
  <p>Would be awesome to have this:</p>
  
  <pre><code>public string Foo(string arg)
  {
      ReturnIfNotNull(GetMeSomething(arg));
  
      ImDoingThings();
  
      return "I did things.";
  }
  </code></pre>