title: When to use InvalidOperationException or NotSupportedException?
body: <p>I am implementing a custom collection implementation that can either be readonly or non-readonly; that is, all the methods that change the collection call a function that is the moral equivalent of:</p>
  
  <pre><code>private void ThrowIfReadOnly() {
      if (this.isReadOnly)
         throw new SomeException("Cannot modify a readonly collection.");
  }
  </code></pre>
  
  <p>I am not sure which of <code>NotSupportedException</code> or <code>InvalidOperationException</code> I should use in that case.</p>