.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

SortingCollection.Add(SortingCollection) Method

Adds the SortProperty objects from the specified collection.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v21.1.dll


public void Add(
    SortingCollection sortProperties


Name Type Description
sortProperties SortingCollection

A SortingCollection object which represents the collection whose elements are added to the current collection.


Adding an element to the collection doesn’t automatically apply sorting by the corresponding property (column). To re-sort data, create a new SortingCollection object, populate it with customized SortProperty objects and reassign it to the XPBaseCollection.Sorting property.


The following example demonstrates how to sort a collection (xpCollectionPerson) in ascending order against a ‘Name’ field.

using DevExpress.Xpo;
using DevExpress.Xpo.DB;

SortingCollection sortCollection = new SortingCollection();
sortCollection.Add(new SortProperty("Name", SortingDirection.Ascending));
xpCollectionPerson.Sorting = sortCollection;
See Also