title: Should IDisposable.Dispose() implementations be idempotent?
body: <p>The Microsoft.NET framework provides the <code>IDisposable</code> interface which requires an implementation of <code>void Dispose()</code> method. Its purpose is to enable manual, or scope-based releasing of expensive resources an <code>IDisposable</code> implementation may have allocated. Examples include database collections, streams and handles. </p>
  
  <p>My question is, should the implementation of the <code>Dispose()</code> method be idempotent - when called more than once on the same instance, the instance to be 'disposed of' only once, and subsequent calls not to throw exceptions. In Java, most of the objects that have similar behavior (again streams and database connections come to my mind as examples) are idempotent for their <code>close()</code> operation, which happens to be the analogue for the <code>Dispose()</code> method.  </p>
  
  <p>However, my personal experience with .NET (and Windows Forms in particular), shows that not all implementations (that are <em>part of the .NET framework itself</em>) are idempotent, so that subsequent calls to these throw an <code>ObjectDisposedException</code>. This really confuses me on how a disposable object's implementation should be approached. Is there a common answer for the scenario, or is it dependent on the concrete context of the object and its usage?</p>