Hi all , May i know should I set an object to nothing even after implementing an IDisposable method to my custom class ? Correct me if i am wrong , if you set it to nothing you are just setting the object to its default value . As you might risk losing a body of references which the GC cant be able to trace later on .
Class TestObject Implements IDisposable ' Implement IDisposable. Public Overloads Sub Dispose() Implements IDisposable.Dispose Dispose(True) GC.SuppressFinalize(Me) End Sub Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean) If disposing Then End If End Sub Protected Overrides Sub Finalize() Dispose(False) End Sub End Class
Dim x as new TestObject '..processing x.Dispose() x = Nothing