Back to Devexpress

SortingCollection Class

xpo-devexpress-dot-xpo-e26e3c72.md

latest4.2 KB
Original Source

SortingCollection Class

A collection of SortProperty objects.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
[ListBindable(BindableSupport.No)]
public sealed class SortingCollection :
    IList,
    ICollection,
    IEnumerable,
    IEnumerable<SortProperty>
vb
<ListBindable(BindableSupport.No)>
Public NotInheritable Class SortingCollection
    Implements IList,
               ICollection,
               IEnumerable,
               IEnumerable(Of SortProperty)

The following members return SortingCollection objects:

LibraryRelated API Members
XPO (.NET ORM Library)ObjectsQuery.Sorting
ObjectStubsQuery.Sorting
XPBaseCollection.Sorting
XPCursor.Sorting
XPDataView.Sorting
XPObjectSource.Sorting
XPView.Sorting
XAF: Cross-Platform .NET App UI & Web APIXPObjectSpace.CreateSortingCollection(IList<SortProperty>)

The following members return SortingCollection objects:

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.

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

SortingCollection sortCollection = new SortingCollection();
sortCollection.Add(new SortProperty("Name", SortingDirection.Ascending));
xpCollectionPerson.Sorting = sortCollection;
vb
Imports DevExpress.Xpo
Imports DevExpress.Xpo.DB

Dim sortCollection As SortingCollection = New SortingCollection()
sortCollection.Add(New SortProperty("Name", SortingDirection.Ascending))
XpCollectionPerson.Sorting = sortCollection

Inheritance

Object SortingCollection

See Also

SortingCollection Members

XPBaseCollection.Sorting

XPCursor.Sorting

XPView.Sorting

XPDataView.Sorting

DevExpress.Xpo Namespace