ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Data Namespace / SortDescription Class
Members Example

In This Topic
    SortDescription Class
    In This Topic
    Specifies a Field to be used to sort the table or feature class and how it should be used.
    Object Model
    SortDescription ClassField Class
    Syntax
    public sealed class SortDescription 
    Public NotInheritable Class SortDescription 
    Example
    Sorting a Table
    public RowCursor SortWorldCities(FeatureClass worldCitiesTable)
    {
      using (FeatureClassDefinition featureClassDefinition = worldCitiesTable.GetDefinition())
      {
        Field countryField = featureClassDefinition.GetFields()
          .First(x => x.Name.Equals("COUNTRY_NAME"));
        Field cityNameField = featureClassDefinition.GetFields()
          .First(x => x.Name.Equals("CITY_NAME"));
    
        // Create SortDescription for Country field
        SortDescription countrySortDescription = new SortDescription(countryField);
        countrySortDescription.CaseSensitivity = CaseSensitivity.Insensitive;
        countrySortDescription.SortOrder = SortOrder.Ascending;
    
        // Create SortDescription for City field
        SortDescription citySortDescription = new SortDescription(cityNameField);
        citySortDescription.CaseSensitivity = CaseSensitivity.Insensitive;
        citySortDescription.SortOrder = SortOrder.Ascending;
    
        // Create our TableSortDescription
        TableSortDescription tableSortDescription = new TableSortDescription(
          new List<SortDescription>() { countrySortDescription, citySortDescription });
    
        return worldCitiesTable.Sort(tableSortDescription);
      }
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Data.SortDescription

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also