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
-
IFilteredXtraBindingListIFilteredDataSourceIList<T>ICollection<T>IEnumerable<T>
- 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
CriteriaOperatorThe 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
PersistentCriteriaEvaluationBehaviorA PersistentCriteriaEvaluationBehavior enumeration value that specifies how the persistent criteria are evaluated.
session
SessionThe Session that will be used to load and save T persistent objects.
condition
CriteriaOperatorThe 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
PersistentCriteriaEvaluationBehaviorA PersistentCriteriaEvaluationBehavior enumeration value that specifies how the persistent criteria are evaluated.
session
SessionThe Session that will be used to load and save T persistent objects.
condition
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection.
selectDeleted
booltrue 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
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
SessionThe Session that will be used to load and save T persistent objects.
theCriteria
CriteriaOperatorThe 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
SessionThe Session that will be used to load and save T persistent objects.
originalCollection
XPBaseCollectionAn 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
SessionThe Session that will be used to load and save T persistent objects.
originalCollection
XPBaseCollectionAn object that implements the IEnumerable interface.
copyFilter
CriteriaOperatorThe 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
SessionThe Session that will be used to load and save T persistent objects.
originalCollection
XPBaseCollectionAn object that implements the IEnumerable interface.
copyFilter
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.
caseSensitive
booltrue 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
SessionThe Session that will be used to load and save T persistent objects.
loadingEnabled
boolA 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
SessionThe Session that will be used to load and save T persistent objects.
originalCollection
IEnumerableAn 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
SessionThe Session that will be used to load and save T persistent objects.
originalCollection
IEnumerableAn object that implements the IEnumerable interface.
copyFilter
CriteriaOperatorThe 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
SessionThe Session that will be used to load and save T persistent objects.
originalCollection
IEnumerableAn object that implements the IEnumerable interface.
copyFilter
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.
caseSensitive
booltrue 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
SessionThe Session that will be used to load and save T persistent objects.
theOwner
objectThe object that will own the new collection.
refProperty
XPMemberInfoThe 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
XPBaseCollectionAn 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
XPBaseCollectionAn XPBaseCollection from which T objects are copied to the newly created collection.
filter
CriteriaOperatorThe 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
XPBaseCollectionAn XPBaseCollection from which T objects are copied to the newly created collection.
filter
CriteriaOperatorThe DevExpress.Data.Filtering.CriteriaOperator that specifies the criteria for object selection from the originalCollection.
caseSensitive
booltrue 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
intThe 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
TA 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
TA 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
objectA 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
TA 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()