You can't expose the ConnectionCollection outside the ConnectionManager class if that's the case. Usually you would have a setup like this:
VB Code:
Public Class ConnectionManager
Private _connections As ConnectionCollection
Public ReadOnly Property Connections() As ConnectionCollection
Get
If Me._connections Is Nothing Then
Me._connections = New ConnectionManager
End If
Return Me._connections
End Get
End Property
End Class
You will not be able to do that though because then the caller would be able to call the methods of the ConnectionCollection object. Instead you must completely conceal the collection, which you can do like this:
VB Code:
Public Class ConnectionManager
Private _connections As ConnectionCollection
Public ReadOnly Property Connections(ByVal index As Integer) As Connection
Get
If Me._connections Is Nothing Then
Me._connections = New ConnectionManager
End If
Return Me._connections(index)
End Get
End Property
End Class
Now all the caller can do is get a reference to a specific Connection object from the collection by providing an index. The property is ReadOnly so they cannot assign a new object to that index and they have no access to the collection itself.