ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / SchemaBuilder Class / Create Method / Create(IndexDescription) Method
Indicates the ArcGIS.Core.Data.Index to be created.
Example

In This Topic
    Create(IndexDescription) Method
    In This Topic
    Enqueue the create operation on the object referred to by the IndexDescription.
    Syntax
    public void Create( 
       IndexDescription indexDescription
    )
    Public Overloads Sub Create( _
       ByVal indexDescription As IndexDescription _
    ) 

    Parameters

    indexDescription
    Indicates the ArcGIS.Core.Data.Index to be created.
    Exceptions
    Example
    Adding indexes in pre-existing dataset
    public void AddingIndexes(SchemaBuilder schemaBuilder, FeatureClassDefinition featureClassDefinition)
    {
      // Field names to add in the attribute index
      string fieldName = featureClassDefinition.GetFields().First(f => f.AliasName.Contains("Name")).Name;
      string fieldAddress = featureClassDefinition.GetFields().First(f => f.AliasName.Contains("Address")).Name;
    
      // Creating an attribute index with index name 'Idx' and two participating fields' name
      AttributeIndexDescription attributeIndexDescription = new AttributeIndexDescription("Idx", new TableDescription(featureClassDefinition), new List<string> { fieldName, fieldAddress });
    
      // Enqueue DDL operation for an attribute index creation 
      schemaBuilder.Create(attributeIndexDescription);
    
      // Creating the spatial index 
      SpatialIndexDescription spatialIndexDescription = new SpatialIndexDescription(new FeatureClassDescription(featureClassDefinition));
    
      // Enqueue DDL operation for the spatial index creation
      schemaBuilder.Create(spatialIndexDescription);
    
      // Execute build indexes operation
      bool isBuildSuccess = schemaBuilder.Build();
    
      if (!isBuildSuccess)
      {
        IReadOnlyList<string> errors = schemaBuilder.ErrorMessages;
        // Iterate and handle errors 
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.1 or higher.
    See Also