SBendBuckeye
Programmer
Hello all,
I would have guessed that an overridden Finalize would be called when the object goes out of scope since at that point it is no loger accessible in code. However, it appears that it is not called until the parent object goes out of scope. I have a class with an overridden Finalize as below:
I have this code in a form's load event:
The Finalize method shown in example 1 above is not called until the form closes. Is this correct behavior? If so, what else can I call because I can't wait until the parent form closes as that could be who knows how long. Thanks in advance for any ideas and/or suggestions!
I would have guessed that an overridden Finalize would be called when the object goes out of scope since at that point it is no loger accessible in code. However, it appears that it is not called until the parent object goes out of scope. I have a class with an overridden Finalize as below:
Code:
Protected Overrides Sub Finalize()
Try
'Do some stuff
Finally
MyBase.Finalize()
End Try
End Sub 'Finalize
Code:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles etc
With New AutomationInfo(Me, "c:\dummy.txt", True)
'Do some stuff
End With
End Sub 'Form1_Load