A COM collection is, as the name implies, a collection of other objects. This collection can be extended -- by adding items -- or reduced. Unlike an Array, the position of an item within a collection can change -- for example, a new initial element can be inserted. In this way, a collection is similar to a Carapace List.
There are a few simple rules which an object must obey for it to be a well-behaved COM collection:
Count
which returns the number of elements within the collection.
NewEnum which is of
type Unknown
Item which must be the
first method on the interface.
Click here for an example of a COM collection in Carapace.
Count
Count the items in the collection. This is of type
Integer.
NewEnumThis property is used to allow COM to enumerate over the collection. It is a dummy property, since it is never set -- it simply exists so that COM knows that this object is to be treated as a collection.
The NewEnum property must be of type Unknown.
ItemReturns the specified item from the collection. Often collections are indexed by an Integer. Occasionally they are indexed by a String.
Arguments:
| index | Object |
Return type: Object
| Contents | Index | Current topic: COM | Related topics: objects, functions |