title: What is best practice for returning value or error message from method in c#?
body: <p>I am trying to find the cleanest solution for returning value or error message from function / method in c#.</p>
  
  <p>For now I have tried:</p>
  
  <pre><code>public float ValidateValue (float value)
  {
      if (value == VALID_VALUE)
      {
          return value;
      }
      else 
      {
          throw new ArgumentException("Invalid value", "value"); 
      }
  }
  </code></pre>
  
  <p>This solution seems to be good enough but in <a href="http://www.planetgeek.ch/wp-content/uploads/2013/06/Clean-Code-V2.2.pdf" rel="nofollow">Clean Code Cheap Sheet</a> I have found:</p>
  
  <blockquote>
    <p>Using Exceptions for Control Flow – Don't do this</p>
    
    <p>Using exceptions for control flow:
    has bad performance, is hard to understand and results in very hard
    handling of real exceptional cases.</p>
  </blockquote>