In ArcObjects there is possibility to perform custom sorting using ITableSortCallBack:
public class CustomTableSort : ITableSortCallBack
{
public int Compare(object value1, object value2, int fieldIndex, int fieldSortIndex)
{
}
}
ITableSort tableSort = new TableSortClass
{
Table = ...,
Fields = ...,
Compare = new CustomTableSort()
};
But unfortunately geometries are not passed to the Compare method. So now there is no easy way to perform custom sort by some spatial criteria out-of-the-box. Developers need write their own sorting algorithms since they cannot use built-in ITableSort interface in this case. It would be great if this limitation of the ITableSortCallBack will be removed.