title: C# A validate method which can return multiple messages
body: <p>I have a situation where I need to check a couple of things before I proceed with saving into the database.</p>
  
  <p>If I want to save an object to the database I have to check two things:</p>
  
  <ol>
  <li>Are all the required things filled?</li>
  <li>Is there already a thing with the same status?</li>
  </ol>
  
  <p>If one of those requirements fails, I'd like to notify the user that it cannot be saved because condition 1 is not met, or condition 2 is not or both conditions are not met.</p>
  
  <p>Should I just create a method named <code>Validate()</code> and put the textual message into the return parameter? Something like</p>
  
  <pre><code>public string Validate()
  {
    string message = string.Empty;
  
    if(! /*Do some validating for 1) */)
      message = "Condition 1 not met";
    if(! /*Do some validating for 2) */)
      message += Environment.NewLine + "Condition 2 not met!"; // 
  
    return message;
  }
  </code></pre>
  
  <p>And then in the calling code check if <code>message</code> is empty or not. Is this a good way? </p>
  
  <p>I have also been thinking about two methods. But then I have to call these two methods everywhere where I want to save the object to the database. This way I am repeating myself. This way you get something like this:</p>
  
  <pre><code>public bool AreRequiredThingsFilled()
  {
    if( /* do something*/ )
      return true;
  
    return false;
  }
  
  public bool CheckStatus()
  {
    if( /* do something*/ )
      return true;
  
    return false;
  }    
  </code></pre>
  
  <p>And then I have to call both methods and in the calling code I have to set the message which I want to show to the user.</p>
  
  <p>I don't know which way to do handle this kind of situations. Is there a best practice for such kind of situations?</p>