CesarGon
asked on
Iterating user collections
I have a class Chair in my system. Now I want to deal with typed collections of chairs, so I have defined a ColChair class, with a collection-like interface: Add, Remove, Item and Count. I have made Item the defaut property. The problem is I can't iterate the collection with a "For Each" construct; it crashes at run-time:
Dim col As New ColChair
'fill col with Chair objects.
Dim ch As Chair
For Each ch In col 'this line crashes.
'do something with ch.
Next ch
Any ideas?.
Regards,
César.
Dim col As New ColChair
'fill col with Chair objects.
Dim ch As Chair
For Each ch In col 'this line crashes.
'do something with ch.
Next ch
Any ideas?.
Regards,
César.
What error to you get?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your reply. It really works!. To satisfy my curiosity, please may you tell me where you learnt the solution?.
Regards,
César.
Regards,
César.