An unordered, unkeyed collection that can contain the same element multiple times. The .NET collections API, has no Bag. The ICollection<(Of <(T>)>) interface closely resembles bag semantics, however NHibernate for .NET 1.1 used IList so IList<(Of <(T>)>) is used to ensure the easiest transition to generics.

Namespace:  NHibernate.Collection.Generic
Assembly:  NHibernate (in NHibernate.dll)

Syntax

Visual Basic (Declaration)
<SerializableAttribute> _
Public Class PersistentGenericBag(Of T) _
	Inherits AbstractPersistentCollection _
	Implements IList(Of T), ICollection(Of T),  _
	IEnumerable(Of T), IList, ICollection, IEnumerable
C#
[SerializableAttribute]
public class PersistentGenericBag<T> : AbstractPersistentCollection, 
	IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, 
	IEnumerable
Visual C++
[SerializableAttribute]
generic<typename T>
public ref class PersistentGenericBag : public AbstractPersistentCollection, 
	IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, 
	IEnumerable
JavaScript
JavaScript does not support generic types or methods.

Type Parameters

T
The type of the element the bag should hold.

Remarks

The underlying collection used is an List<(Of <(T>)>)

Inheritance Hierarchy

System..::.Object
  NHibernate.Collection..::.AbstractPersistentCollection
    NHibernate.Collection.Generic..::.PersistentGenericBag<(Of <(T>)>)

See Also