Reputation: 781
I've seen that multiple times. Last time i saw it when somebody created an excel application object. He ended his application like that:
myExcelObj = Nothing
Application.Exit()
I'm sure making the reference point to nothing won't close the excel application running in the backround. Also saw that alot with non visible objects like the following:
Public Class myClass
Var1 as Integer = 0
Var2 as SQLConnection
Var3 as Whatever
Public Sub New()
Var1 = Maths.Rnd(0,1)
Var2 = SomeStaticClass.GetSQLConnection()
Var3 = New Whatever(Var1)
End Sub
End Sub
(...)
// Somewhere in the Code (...)
Private Sub EndItAll(sender as Object, e as EventArgs)
Me.My_myClassObject = Nothing
Application.Exit()
End Sub
Does that make any sense? Won't closing the application itself free every used memory anyways? When does it make sense to do so?
Upvotes: 2
Views: 68
Reputation: 365
This might answer your question: https://blogs.msdn.microsoft.com/ericlippert/2004/04/28/when-are-you-required-to-set-objects-to-nothing/
But that ignoring that little link right there, no it kinda makes no sense, at least in this day and age, like he says in the post, perhaps in an older version that was required.
Upvotes: 1
Reputation: 442
Before the application ends? Pointless.
Otherwise it is good practice, IMHO.
Upvotes: 1