Table of Contents

Class XPCollection<T>

Namespace
DevExpress.Xpo
Assembly
DevExpress.Xpo.v24.1.dll

A generic type collection of persistent objects.

public class XPCollection<T> : XPBaseCollection, IComponent, IDisposable, IBindingList, ITypedList, ISupportInitialize, IXPClassInfoAndSessionProvider, IXPClassInfoProvider, ISessionProvider, IObjectLayerProvider, IDataLayerProvider, IXPDictionaryProvider, IObjectChange, IFilteredXtraBindingList, IFilteredDataSource, IXPPrefetchableAssociationList, IXPBulkLoadableCollection, IList, ICollection, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable

Type Parameters

T

The type of elements in the collection.

Inheritance
XPCollection<T>
Implements
IFilteredXtraBindingList
IFilteredDataSource
Inherited Members

Constructors

XPCollection()

Initializes a new instance of the XPCollection<T> class with the default Session.

public XPCollection()

XPCollection(CriteriaOperator, params SortProperty[])

Initializes a new instance of the XPCollection<T> class with default Session and criteria-specific options.

public XPCollection(CriteriaOperator theCriteria, params SortProperty[] sortProperties)

Parameters

theCriteria CriteriaOperator

The DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.

sortProperties SortProperty[]

An array of DevExpress.Xpo.SortProperty that specifies the sort order for the collection.

XPCollection(PersistentCriteriaEvaluationBehavior, Session, CriteriaOperator)

Initializes a new instance of the XPCollection<T> class with specified settings.

public XPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, CriteriaOperator condition)

Parameters

criteriaEvaluationBehavior PersistentCriteriaEvaluationBehavior

A PersistentCriteriaEvaluationBehavior enumeration value that specifies how the persistent criteria are evaluated.

session Session

The Session that will be used to load and save T persistent objects.

condition CriteriaOperator

The DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.

XPCollection(PersistentCriteriaEvaluationBehavior, Session, CriteriaOperator, bool)

Initializes a new instance of the XPCollection<T> class with specified settings.

public XPCollection(PersistentCriteriaEvaluationBehavior criteriaEvaluationBehavior, Session session, CriteriaOperator condition, bool selectDeleted)

Parameters

criteriaEvaluationBehavior PersistentCriteriaEvaluationBehavior

A PersistentCriteriaEvaluationBehavior enumeration value that specifies how the persistent criteria are evaluated.

session Session

The Session that will be used to load and save T persistent objects.

condition CriteriaOperator

The DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.

selectDeleted bool

true if objects marked as deleted are loaded to the collection from a data store; otherwise, false.

XPCollection(Session)

Initializes a new instance of the XPCollection<T> class with a specified Session.

public XPCollection(Session session)

Parameters

session Session

The Session that will be used to load and save T persistent objects.

XPCollection(Session, CriteriaOperator, params SortProperty[])

Initializes a new instance of the XPCollection<T> class with a specified Session and criteria-specific options.

public XPCollection(Session session, CriteriaOperator theCriteria, params SortProperty[] sortProperties)

Parameters

session Session

The Session that will be used to load and save T persistent objects.

theCriteria CriteriaOperator

The DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.

sortProperties SortProperty[]

An array of DevExpress.Xpo.SortProperty that specifies the sort order for the collection.

XPCollection(Session, XPBaseCollection)

Initializes a new instance of the XPCollection<T> class by copying T objects from a specific collection using specified settings.

public XPCollection(Session session, XPBaseCollection originalCollection)

Parameters

session Session

The Session that will be used to load and save T persistent objects.

originalCollection XPBaseCollection

An object that implements the IEnumerable interface.

XPCollection(Session, XPBaseCollection, CriteriaOperator)

Initializes a new instance of the XPCollection<T> class by copying T objects from a specific collection using specified settings.

public XPCollection(Session session, XPBaseCollection originalCollection, CriteriaOperator copyFilter)

Parameters

session Session

The Session that will be used to load and save T persistent objects.

originalCollection XPBaseCollection

An object that implements the IEnumerable interface.

copyFilter CriteriaOperator

The DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.

XPCollection(Session, XPBaseCollection, CriteriaOperator, bool)

Initializes a new instance of the XPCollection<T> class by copying T objects from a specific collection using specified settings.

public XPCollection(Session session, XPBaseCollection originalCollection, CriteriaOperator copyFilter, bool caseSensitive)

Parameters

session Session

The Session that will be used to load and save T persistent objects.

originalCollection XPBaseCollection

An object that implements the IEnumerable interface.

copyFilter CriteriaOperator

The DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.

caseSensitive bool

true if string comparisons are case-sensitive; otherwise, false. This value is assigned to the XPBaseCollection.CaseSensitive property.

XPCollection(Session, bool)

Initializes a new instance of the XPCollection<T> class with specified settings.

public XPCollection(Session session, bool loadingEnabled)

Parameters

session Session

The Session that will be used to load and save T persistent objects.

loadingEnabled bool

A Boolean value that specifies whether the collection is automatically populated with T objects from the data store when the collection is accessed for the first time (for instance, when the XPBaseCollection.Count property is read). This parameter is used to initialize the XPBaseCollection.LoadingEnabled property.

XPCollection(Session, IEnumerable)

Initializes a new instance of the XPCollection<T> class by copying T objects from a specific collection using specified settings.

public XPCollection(Session session, IEnumerable originalCollection)

Parameters

session Session

The Session that will be used to load and save T persistent objects.

originalCollection IEnumerable

An object that implements the IEnumerable interface.

XPCollection(Session, IEnumerable, CriteriaOperator)

Initializes a new instance of the XPCollection<T> class by copying T objects from a specific collection using specified settings.

public XPCollection(Session session, IEnumerable originalCollection, CriteriaOperator copyFilter)

Parameters

session Session

The Session that will be used to load and save T persistent objects.

originalCollection IEnumerable

An object that implements the IEnumerable interface.

copyFilter CriteriaOperator

The DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.

XPCollection(Session, IEnumerable, CriteriaOperator, bool)

Initializes a new instance of the XPCollection<T> class by copying T objects from a specific collection using specified settings.

public XPCollection(Session session, IEnumerable originalCollection, CriteriaOperator copyFilter, bool caseSensitive)

Parameters

session Session

The Session that will be used to load and save T persistent objects.

originalCollection IEnumerable

An object that implements the IEnumerable interface.

copyFilter CriteriaOperator

The DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.

caseSensitive bool

true if string comparisons are case-sensitive; otherwise, false. This value is assigned to the XPBaseCollection.CaseSensitive property.

XPCollection(Session, object, XPMemberInfo)

Initializes a new instance of the XPCollection<T> class with specified settings.

public XPCollection(Session session, object theOwner, XPMemberInfo refProperty)

Parameters

session Session

The Session that will be used to load and save T persistent objects.

theOwner object

The object that will own the new collection.

refProperty XPMemberInfo

The owner’s property for which the related object collection is created.

XPCollection(XPBaseCollection)

Initializes a new instance of the XPCollection<T> class by copying T objects from a specified collection.

public XPCollection(XPBaseCollection originalCollection)

Parameters

originalCollection XPBaseCollection

An XPBaseCollection from which T objects are copied to the newly created collection.

XPCollection(XPBaseCollection, CriteriaOperator)

Initializes a new instance of the XPCollection<T> class by copying T objects from a specific collection using specified settings.

public XPCollection(XPBaseCollection originalCollection, CriteriaOperator filter)

Parameters

originalCollection XPBaseCollection

An XPBaseCollection from which T objects are copied to the newly created collection.

filter CriteriaOperator

The DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.

XPCollection(XPBaseCollection, CriteriaOperator, bool)

Initializes a new instance of the XPCollection<T> class by copying T objects from a specific collection using specified settings.

public XPCollection(XPBaseCollection originalCollection, CriteriaOperator filter, bool caseSensitive)

Parameters

originalCollection XPBaseCollection

An XPBaseCollection from which T objects are copied to the newly created collection.

filter CriteriaOperator

The DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.

caseSensitive bool

true if string comparison operators specified by the copyFilter are case-sensitive; otherwise, false. This value is assigned to the XPBaseCollection.CaseSensitive property.

Properties

this[int]

Gets a T object at a specified index in the XPCollection<T>.

[Browsable(false)]
public T this[int index] { get; }

Parameters

index int

The zero-based index of the object to get.

Property Value

T

A T object at the specified index in the collection.

Methods

Add(T)

Adds a specified persistent object to the XPCollection<T>.

public void Add(T newObject)

Parameters

newObject T

A T persistent object to add to the collection. This can be any object that implements the IXPSimpleObject interface or has the PersistentAttribute attribute.

AddRange(IEnumerable<T>)

Adds specified persistent objects to the XPCollection<T>.

public void AddRange(IEnumerable<T> objects)

Parameters

objects IEnumerable<T>

An IEnumerable<T> object, which is a collection of T persistent objects to add to the XPCollection<T>.

GetObjectClassInfo()

Gets the metadata information for the persistent objects contained in the collection.

public override XPClassInfo GetObjectClassInfo()

Returns

XPClassInfo

An XPClassInfo object associated with the T type.

IndexOf(T)

Returns the index of a specified T object in the XPCollection<T>.

public int IndexOf(T theObject)

Parameters

theObject T

A T object to locate in the collection.

Returns

int

The zero-based index of the object in the collection, if found; otherwise, -1.

Lookup(object)

Retrieves a T object from the collection by a specified key value.

public T Lookup(object key)

Parameters

key object

A key value of an object to retrieve from the collection.

Returns

T

A T object found or null reference (Nothing in VisualBasic) if an object does not exist in the collection.

Remove(T)

Removes the specified object from the XPCollection<T>.

public bool Remove(T theObject)

Parameters

theObject T

A T object to remove from the collection.

Returns

bool

true if the specified object has been successfully removed from the collection; otherwise, false.

RenewObjectClassInfoOnSessionChange()

protected override void RenewObjectClassInfoOnSessionChange()