title: Good practice for Output parameter in C#
body: <p>I have been a C/C++ programmer and new to C#.</p>
  
  <p>I want to return multiple params from a function along with status, so I want to use them as output params. Here is an example.</p>
  
  <pre><code>bool SomeFunction(string inStr, out string outStr)
  {
      if (someCondition)
      {
          outStr = AnotherFunction(inStr);
          return true;
      }
      return false;
  }
  </code></pre>
  
  <p>I want to set value of outStr only based on some condition and not always. However, it does not compile and I have to initialize outStr with some value like below.</p>
  
  <pre><code>bool SomeFunction(string inStr, out string outStr)
  {
      outStr = string.Empty; // this makes it compile
      if (someCondition)
      {
          outStr = AnotherFunction(inStr);
          return true;
      }
      return false;
  }
  </code></pre>
  
  <p>I am looking to not initialize it if some condition fails. In that case, I want to return with an error without initializing. I know it is possible with keyword ref instead of out and I know the difference between ref and out. Is use of ref in such use case a good practice? What are the best practices for output params in a function. Thanks in advance!</p>