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

In This Topic
    TableDescription Class
    In This Topic
    Represents a mechanism to create a ArcGIS.Core.Data.Table.
    Syntax
    public class TableDescription : Description 
    Public Class TableDescription 
       Inherits Description
    Example
    Renaming a Table
    //Renaming a table from 'Original_Table' to 'Renamed_Table'
    
    string tableToBeRenamed = "Original_Table";
    string tableRenameAs = "Renamed_Table";
    
    TableDefinition tableDefinition = geodatabase.GetDefinition<TableDefinition>(tableToBeRenamed);
    
    SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
    // Table rename 
    schemaBuilder.Rename(new TableDescription(tableDefinition), tableRenameAs);
    schemaBuilder.Build();
    
    Removing fields from a Table
    // 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();
    
    
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Data.DDL.Description
          ArcGIS.Core.Data.DDL.TableDescription
             ArcGIS.Core.Data.DDL.FeatureClassDescription

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also