ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / SchemaBuilder Class / Modify Method / Modify(TableDescription) Method
Indicates the ArcGIS.Core.Data.Table to be modified.
Example

In This Topic
    Modify(TableDescription) Method
    In This Topic
    Enqueue the modify operation on the object referred to by the TableDescription.
    Syntax
    public void Modify( 
       TableDescription tableDescription
    )
    Public Overloads Sub Modify( _
       ByVal tableDescription As TableDescription _
    ) 

    Parameters

    tableDescription
    Indicates the ArcGIS.Core.Data.Table to be modified.
    Exceptions
    ExceptionDescription
    The subtypes are invalid.
    tableDescription is null.
    Example
    Removing fields from a Table
    public void RemoveFieldTableSnippet(Geodatabase geodatabase)
    {
      // Removing all fields from 'Parcels' table except following 
      // Tax_Code
      // Parcel_Address
    
      // The table to remove fields
      string tableName = "Parcels";
    
      TableDefinition tableDefinition = geodatabase.GetDefinition<TableDefinition>(tableName);
      IReadOnlyList<Field> fields = tableDefinition.GetFields();
    
      // Existing fields from 'Parcels' table
      Field taxCodeField = fields.First(f => f.Name.Equals("Tax_Code"));
      Field parcelAddressField = fields.First(f => f.Name.Equals("Parcel_Address"));
    
      FieldDescription taxFieldDescription = new FieldDescription(taxCodeField);
      FieldDescription parcelAddressFieldDescription = new FieldDescription(parcelAddressField);
    
      // Fields to retain in modified table
      List<FieldDescription> fieldsToBeRetained = new List<FieldDescription>()
      {
        taxFieldDescription, parcelAddressFieldDescription
      };
    
      // New description of the 'Parcels' table with the 'Tax_Code' and 'Parcel_Address' fields
      TableDescription modifiedTableDescription = new TableDescription(tableName, fieldsToBeRetained);
    
      SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
      // Remove all fields except the 'Tax_Code' and 'Parcel_Address' fields
      schemaBuilder.Modify(modifiedTableDescription);
      schemaBuilder.Build();
    }
    Removing subtype field designation
    public void DeleteSubtypeField(SchemaBuilder schemaBuilder, FeatureClassDefinition featureClassDefinition)
    {
      FeatureClassDescription featureClassDescription = new FeatureClassDescription(featureClassDefinition);
    
      // Set subtype field to null to remove the subtype field designation 
      featureClassDescription.SubtypeFieldDescription = null;
    
      schemaBuilder.Modify(featureClassDescription);
      schemaBuilder.Build();
    }
    Modifying subtypes
    public void ModifySubtypes(SchemaBuilder schemaBuilder, TableDefinition tableDefinition)
    {
      TableDescription tableDescription = new TableDescription(tableDefinition);
    
      // Remove the first subtype from the table
      IReadOnlyList<Subtype> subtypes = tableDefinition.GetSubtypes();
      tableDescription.SubtypeFieldDescription.Subtypes.Remove(subtypes.First().GetCode());
    
      // Adding a new subtype, 'Utility', in the existing table
      tableDescription.SubtypeFieldDescription.Subtypes.Add(4, "Utility");
    
      // Assigning 'Utility' subtype as the default subtype
      tableDescription.SubtypeFieldDescription.DefaultSubtypeCode = 4;
    
      schemaBuilder.Modify(tableDescription);
      schemaBuilder.Build();
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also