🖥️ VB CURSE DIFFICULTY: Apprentice Behavioral

The Iterator of Collections

Traversing undocumented COM collections.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Iterator
ARCANUM SCHOOL: Divination // Traversal
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// VB PATTERN //
' Traversal.bas
Public Sub TraverseCursedObjects(col As Collection)
    On Error Resume Next
    Dim it As Variant
    ' For Each implicitly uses IEnumVARIANT
    For Each it In col
        Debug.Print TypeName(it)
    Next it
End Sub

Under the hood of every For Each loop lies the IEnumVARIANT interface. The Iterator pattern in VB6 harnesses this built-in magic to traverse collections of unstable COM objects gracefully.

Runic Tags: #iterator #collections #com