Destroy_Class

    1| using System;
    2| using System.Collections.Generic;
    3| using System.Linq;
    4| using System.Text;
    5| 
    6| namespace MyDesktop
    7| {
    8|     class Destroy_Class
    9|     {
  10|         public Destroy_Class()
  11|         {
  12| 
  13|         }
  14| 
  15|         //This method destroys and garbage collects an array of drive objects
  16|         public void Destroy_Drive_Objects(Drives_Class[] oDrive)
  17|         {
  18|             int iObjects = Drives_Class.iNextDriveObj;
  19| 
  20|             //Set to the last object instantiated
  21|             iObjects--;
  22| 
  23|             //For each object in the array set it to null/call destructory method
  24|             while (iObjects >= 0)
  25|             {
  26|                 oDrive[iObjects] = null;
  27|                 iObjects--;
  28|             }
  29| 
  30|             //Force the garbage collection
  31|             System.GC.Collect();
  32|         }
  33| 
  34|         //This method destroys and garbage collects an array of app objects
  35|         public void Destroy_App_Objects(Apps_Class[] oApp)
  36|         {
  37|             int iObjects = Apps_Class.iNextAppObj;
  38| 
  39|             //Set to the last object instantiated
  40|             iObjects--;
  41| 
  42|             //For each object in the array set it to null/call destructory method
  43|             while (iObjects >= 0)
  44|             {
  45|                 oApp[iObjects] = null;
  46|                 iObjects--;
  47|             }
  48| 
  49|             //Force the garbage collection
  50|             System.GC.Collect();
  51|          }
  52| 
  53|         //This method destroys and garbage collects an array of site objects
  54|         public void Destroy_Site_Objects(Sites_Class[] oSite)
  55|         {
  56|             int iObjects = Sites_Class.iNextSiteObj;
  57| 
  58|             //Set to the last object instantiated
  59|             iObjects--;
  60| 
  61|             //For each object in the array set it to null/call destructory method
  62|             while (iObjects >= 0)
  63|             {
  64|                 oSite[iObjects] = null;
  65|                 iObjects--;
  66|             }
  67| 
  68|             //Force the garbage collection
  69|             System.GC.Collect();
  70|         }
  71| 
  72|     }//end of class
  73| }