Use a custom class in a For Each loop
<p>I have a class with an array field, like this:</p>

<pre><code>Private storage() as Integer
'some logic here
</code></pre>

<p>How can i use this class in a For Each loop like the Collection class? Example:</p>

<pre><code>Dim coll as new Collection
Dim value as Variant
For Each value in coll
    'do something
Next value
</code></pre>

<p>I know only the decision for a collection type field:</p>

<pre><code>Public Property Get NewEnum() As IUnknown
    Attribute NewEnum.VB_UserMemId = -4
    Set NewEnum = storage.[_NewEnum]    
End Property
</code></pre>

<p>Can i make something similar for an array type field?</p>

<p>More accurate, I meant something like applying Iterator interface with a For Each loop in Java.</p>