Skip to main content
.NET 6.0+

XPCollection<T>.Add(T) Method

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

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v23.2.dll

NuGet Package: DevExpress.Xpo

Declaration

public void Add(
    T newObject
)

Parameters

Name Type Description
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.

Remarks

Once an XPCollection<T> is loaded, it contains T objects that match the specified criteria (see XPBaseCollection.Criteria). When you add a T object (newObject), the collection does not check whether this object matches the criteria or not.

Note

You cannot add an object whose type is not the same or not inherited from the type specified by the XPCollection<T>.GetObjectClassInfo method. In addition, you cannot add the same object more than once. Doing so does not raise an exception, however the object will not be added to the collection.

See Also