title: How I safely dispose a variable?
body: <p>What is an alternate/better way I can safely dispose of the variables <code>purge</code> and <code>factory</code> in the following code?  </p>
  
  <pre><code>        public void Run( string XmlFragment ) {
              XmlNode xmlNode = null;
  
              try
              {
                  xmlNode = Common.ConstructXmlNodeFromString(XmlFragment, "Params");
                  var list = DataList();
  
                  foreach (var item in list)
                  {
                      var factory = new PurgerFactory(item);
                      IPurger purge = factory.Purger;
  
                      purge.Purge();
  
                      purge = null;
                      factory = null;
                  }
  
                  Common.PurgeEmail(SuccessEmail());
              }
              catch (Exception ex)
              {
                  string errorMessage = $"Purge Error:  {ex.Message}. {Environment.NewLine} Stack Trace: {ex.StackTrace}";
                  Common.PurgeEmail(FailEmail(errorMessage));
              }
          }
  </code></pre>