This document is archived and information here might be outdated.  Recommended version.

ITableSort Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IT > ITableSort Interface
ArcGIS Developer Help

ITableSort Interface

Provides access to members that return and modify information to sort a table.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


The ITableSort interface is used to sort data from a table, cursor, or selection set, and returns the sorted rows as a cursor or an ID enumerator.


Name Description
Write-only property Ascending Field sort order.
Write-only property CaseSensitive Character fields case sensitive. Default: False.
Write-only property Compare Compare call back interface. Specify Null (default) for normal behavior.
Write-only property Cursor The cursor of the data to sort on. Ensure that sorting fields are available. Cancels SelectionSet.
Write-only property Fields Comma list of field names to sort on.
Read-only property IDByIndex A id by its index value.
Read-only property IDs List of sorted IDs.
Read/write property QueryFilter The query filter on table or selection set.
Read-only property Rows Cursor of sorted rows.
Write-only property SelectionSet The selection set as a source of the data to sort on. Cancels Cursor.
Read-only property SelectionSet The selection set as a source of the data to sort on. Cancels Cursor.
Method Sort Sort rows.
Write-only property SortCharacters Number of characters to sort on, for string fields. A null (default) sorts on the whole string.
Write-only property Table The table as a source of the data to sort on.
Read-only property Table The table as a source of the data to sort on.

Classes that implement ITableSort

Classes Description
TableSort Esri Table Sort object.


The Fields property is required. It is a comma-delimited list of the fields to be sorted. When the sort method is called, the first field is sorted, then the second field, and so on. The Table property specifies the table or object class on which the sort is to be performed. Alternatively, the Cursor property may be used to indicate the data to be sorted. If you use the Cursor property, you must also set the Table property to the table referenced by the cursor.

If the SelectionSet property is set, the Table property is set automatically, and the Cursor property remains optional.

The Ascending, CaseSensitive, Compare, QueryFilter, SelectionSet, and SortCharacters properties may also be used to further define how the data is to be sorted.

Once the desired sorting properties have been set, the sort method must be called to order the rows. Either the Rows property or the IDs property can then be used to access the data in sorted order.

A custom class that implements ITableSortCallBack can be used to apply a user defined sorting algorithm instead of the default. The Compare property gives the TableSort object access to an instance of a custom class.

See Also

ICursor Interface | ITable Interface | IQueryFilter Interface

.NET Samples

Multivariate renderer