concept bag in category .net

appears as: bags, bag, bag
NHibernate in Action

This is an excerpt from Manning's book NHibernate in Action.

An unordered collection that permits duplicate elements is called a bag. Curiously, the .NET framework doesn’t define an IBag interface. NHibernate lets you use an IList in .NET to simulate bag behavior; this is consistent with common usage in the .NET community. To use a bag, change the type of Images in Item from ISet to IList, probably using ArrayList as an implementation.

Figure 6.4. Table structure using a bag with a surrogate primary key

If you’re wondering why you use <idbag> rather than <bag>, bear in mind that we’ll be discussing bags shortly. First, we’ll discuss another common approach to storing images: in an ordered list.