hi,
i've been trying to get my head around using 'dispose', but can't quiet seem to do it... i was wondering if someone could explain 'dispose' in lamans terms... for example, if i have the following function:
Public Function IsDrawingOpen(ByVal sPath As String) As Boolean
Dim docDrawing As Document
For Each docDrawing In Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager
If docDrawing.Name = sPath Then
docDrawing.Dispose()
Return True
Exit For
End If
Next
Return False
End Function
do i need to use the docDrawings.Dispose() function??? or do i use the docDrawings = nothing (do we use the 'nothing' at all anymore???) when do i use the Implements IDisposable interface??? and then theres the following 2 functions which have caused a bit more confusion...
Public Overloads Sub Dispose() Implements IDisposable.Dispose
'send to OUR implementation of Dispose
Dispose(True)
'return to control to the standardgarbage collector
GC.SuppressFinalize(Me)
End Sub
Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean)
'override standard Dispose with OUR own
If disposing Then
'clean up global variables
If Not IsNothing(m_UC1) Then m_UC1.Dispose()
If Not IsNothing(m_UC2) Then m_UC2.Dispose()
'clean up COM objects
If Not IsNothing(m_Palette) Then InteropServices.Marshal.ReleaseComObject(m_Palette)
If Not IsNothing(m_PaletteSet) Then InteropServices.Marshal.ReleaseComObject(m_PaletteSet)
End If
End Sub
any help would be great
cheers
mark