I am implementing IDisposable for a class and while disposing there is a internal list of disposable objects. Should I be disposing those object by looping through them.
public Class MyDisposable
Implements IDisposable
private _disposbaleObjects as new List(of OtherDisposables)
Public Overloads Sub Dispose() Implements System.IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
? Should I dispose the the list like this ?
For Each obj In _disposbaleObjects
obj.dispose()
Next
End If
End If
Me.disposedValue = True
End Sub
End Class