Heterogeneous Collections of Objects

Every collection of relationships is homogeneous. In any relationship collection, each item is a relationship of the same relationship type. Some collections of objects, however, are heterogeneous, the items can have different classes.

A collection of objects can be heterogeneous because:

Each relationship type describes how the objects of classes implementing particular interfaces can be related. Thus, if a particular interface has several implementing classes, some relationship types involving that interface could yield collections whose target objects span several classes. As you prepare programs that manipulate such collections, do not assume that the collections will contain homogeneous sets of objects.

Note   Plan for change; do not assume that your tool information model will remain unchanged. Although a particular relationship type of your tool information model might associate two interfaces that are implemented by exactly one class each, you might someday create other classes that implement those same interfaces. Enlargement of the number of classes implementing either of those interfaces by any Microsoft® Repository user introduces the possibility for heterogeneous collections of objects. If your programs using those collections depend upon homogeneous collections, you must rewrite them as soon as you implement the interfaces with several classes. To protect your programs from this cause of obsolescence, write them assuming that any collection of objects can be heterogeneous.

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.