Skip to main content
.NET Standard 2.0+

SortingCollection Class

A collection of SortProperty objects.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v22.1.dll

Declaration

[ListBindable(BindableSupport.No)]
public sealed class SortingCollection :
    IList,
    ICollection,
    IEnumerable,
    IEnumerable<SortProperty>

The following members return SortingCollection objects:

Library Related API Members
eXpressApp Framework XPObjectSpace.CreateSortingCollection(IList<SortProperty>)
eXpress Persistent Objects ObjectsQuery.Sorting
ObjectStubsQuery.Sorting
XPBaseCollection.Sorting
XPCursor.Sorting
XPDataView.Sorting
XPObjectSource.Sorting
XPView.Sorting

Remarks

The collection can be assigned to the XPCollection, XPView, XPDataView, or XPCursor object via an object’s Sorting property.

Note

Don’t make your code dependent on the order of records returned by these objects, unless you’ve explicitly sorted them. By default, if the XPCollection, XPView, XPDataView, or XPCursor is not sorted, records will be returned in an arbitrary order. This mimics the behavior of the SQL SELECT statement used in the same circumstances.

Example

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;

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SortingCollection class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

Object
SortingCollection
See Also