Visualizing associations with generics on a class diagram

Visualizing associations with generics on a class diagram

November 21, 2005 | Visual Studio 2005

Thanks to a student, Jim Munn, for originally asking the question “When adding a property to an object that uses System.Collections.Generic.List<> the designer doesn’t show a relation to the class that the generic collection is typed to. Why not?”

So, let’s assume you have two classes: Customer and Order

Notice how, by default, the association is not displayed between the Customer and Order class. By right-clicking either the mOrders field or Orders property and selecting Show as Collection Association, the association will be visualized: