title: How to use IDisposable to dispose an object
body: <p>I want to use IDisposable interface to clean any resource from the memory, that is not being used.</p>
  
  <pre><code>public class dispose:IDisposable
  {
          public void Dispose()
          {
  
              throw new NotImplementedException();
          }
  
          public void fun()
          {
              PizzaFactory _pz = new PizzaFactory();   //
          }
      }
  </code></pre>
  
  <p>I want to dispose <code>pz</code> object, when there is no ref to it exists. Please let me know how to do it.</p>