title: Declare IDisposable for the class or interface?
body: <p>Starting from the following situation:</p>
  <pre><code>public interface ISample
  {
  }
  
  public class SampleA : ISample
  {
     // has some (unmanaged) resources that needs to be disposed
  }
  
  public class SampleB : ISample
  {
     // has no resources that needs to be disposed
  }
  </code></pre>
  <p>The class SampleA should implement the interface IDisposable for releasing resources.
  You could solve this in two ways:</p>
  <p><strong>1. Add the required interface to the class SampleA:</strong></p>
  <pre><code>public class SampleA : ISample, IDisposable
  {
     // has some (unmanaged) resources that needs to be disposed
  }
  </code></pre>
  <p><strong>2. Add it to the interface ISample and force derived classes to implement it:</strong></p>
  <pre><code>public interface ISample : IDisposable
  {
  }
  </code></pre>
  <p>If you put it into the interface, you force any implementation to implement IDisposable even if they have nothing to dispose. On the other hand, it is very clear to see that the concrete implementation of an interface requires a dispose/using block and you don't need to cast as IDisposable for cleaning up. There might be some more pros/cons in both ways... why would you suggest to use one way preferred to the other?</p>