title: Correct exception for an empty\null string passed to a constructor
body: <p>I have a class:</p>
  
  <pre><code>class Foo
  {
      public Foo(string bar)
      {
          if (string.IsNullOrEmpty(bar))
              throw new Exception("bar must not be null or empty.");
      }
  }
  </code></pre>
  
  <p>What is the <em>most correct</em> exception type to throw?</p>
  
  <p>Viable candidates are:</p>
  
  <ol>
  <li><code>ArgumentNullException</code></li>
  <li><code>ArgumentException</code></li>
  <li><code>InvalidOperationException</code></li>
  <li><strike> <code>TypeInitializationException</code></strike>  (not this as per dasblinkenlight below)</li>
  </ol>
  
  <p>My instinct is to go with <code>InvalidOperationException</code>, as the caller is attempting to construct the object in a illegal state, though <code>ArgumentException</code> has merits as well.</p>
  
  <p>I wish there was a <code>StringNullOrEmptyException</code>, wouldn't that be great?</p>
  
  <p><strong>Edit</strong>
  Thanks for the suggested question, it is similar, but I was asking specifically about it happening in the constructor and whether that would change the recommendation at all.</p>