title: Is it possible to set to null an instance of a class within the class
body: <p>Is it possible to set to null an instance of a class within the class. For example, could I do something like this</p>
  
  <pre><code>int main{
      //Create a new test object
      Test test = new Test();
      //Delete that object. This method should set the object "test" to null, 
      //thus allowing it to be called by the garbage collector.
      test.delete();
  
  }
  
  
  public class Test{
  
      public delete(){
          this = null;
      }
  }
  </code></pre>
  
  <p>I have tried this and it does not work. Using "this = null" I get the error that the left hand side needs to be a variable. Is there a way to achieve something similar? </p>