--With array:
dim o() as object
redim o(9)
for k = 0 ubound(o)
set o(k) = new object
o(k).Property = 100
--With collections
dim c as new Collection
dim o as object
for k = 0 to 9
set o = new object
c.add o
for each o in c
o.property = 100
----
what is nice of collection is that objects can be added, removed, inserted. If each object can have an unique key (string), objects can be accessed very fast using that key. For example, a collection of persons can use the SSN as an index when the object is added:
personCollection.add personObject, SSNofThisPerson
to retrive the object:
personObject = personCollection.Item(SSNofThisPerson)
Marco
|