Hi all,
What is the best practice on disposing objects in a .net method? I tend to avoid try/catch blocks as much as possible, so lets say I have a method in vb.net code behind that instantiates an object (The object may be a local variable or a class variable).
Should I call objectName.dispose() when I am done with it?
I am keeping in mind that I should aquire the object late and release it early during that method execution.
code looks like this:
Private Sub Entity_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Dim db As New LinqDataAccess.QuantumDataContext
Dim result = db.GetAddressType("Company")
'''''Dispose it
db.dispose()
...
Go to the complete details ...