coclass - , Microsoft . , , CLSID. , , , . , [noncreatable].
, , vba7.dll, Collection. KB VB6 . , , 18 - , VB6. MSDN Ebay.
, , KB. , , - Collection. COM .
:
Imports System.Runtime.InteropServices
Namespace VBA
<ComVisible(True), Guid("A4C46780-499F-101B-BB78-00AA00383CBB")>
Public Interface _Collection
<DispId(0)> Function Item(<[In]> ByRef Index As Object) As Object
<DispId(1)> Sub Add(<[In]> ByRef Item As Object, ByRef Optional Key As Object = Nothing,
ByRef Optional Before As Object = Nothing,
ByRef Optional After As Object = Nothing)
<DispId(2)> Function Count() As Integer
<DispId(3)> Sub Remove(<[In]> ByRef Index As Object)
<DispId(-4)> Function _NewEnum() As IEnumerator
End Interface
'' <ComVisible(True)>
<ClassInterface(ClassInterfaceType.None), Guid("A4C4671C-499F-101B-BB78-00AA00383CBB")>
Public Class Collection
Implements _Collection
Private impl As New Microsoft.VisualBasic.Collection
Public Sub Add(ByRef Item As Object, ByRef Optional Key As Object = Nothing, ByRef Optional Before As Object = Nothing, ByRef Optional After As Object = Nothing) Implements _Collection.Add
impl.Add(Item, CStr(Key), Before, After)
End Sub
Public Sub Remove(ByRef Index As Object) Implements _Collection.Remove
If TypeOf Index Is String Then impl.Remove(CStr(Index)) Else impl.Remove(CInt(Index))
End Sub
Public Function Count() As Integer Implements _Collection.Count
Return impl.Count
End Function
Public Function _NewEnum() As IEnumerator Implements _Collection._NewEnum
Return impl.GetEnumerator()
End Function
Public Function Item(ByRef Index As Object) As Object Implements _Collection.Item
Return impl(Index)
End Function
End Class
End Namespace
, Collection VBA.Collection, . , , .