Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dispose before leaving ?

Status
Not open for further replies.

TipGiver

Programmer
Sep 1, 2005
1,863
I have this:
Code:
    Private Function CreateBuffer(ByVal cmd As Byte) As ArrayList

        Dim _b As New ArrayList
        _b.Add(cmd)

        Try
            Return (_b)
        Finally
            _b = Nothing
        End Try

    End Function

How can it dispose the _b before getting out of the function ? Is there any other way appart from this ?
 
no need to set it to nothing. Once out of scope the gc will pick it up. setting it to nothing will not help any.

Christiaan Baes
Belgium

My Blog
 
Hmm, ok. The GC itself without having to call the .Collect(), right ?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top