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

In This Topic
    Modify(FeatureClassDescription) Method
    In This Topic
    Enqueue the modify operation on the object referred to by the FeatureClassDescription.
    Syntax

    Parameters

    featureClassDescription
    Indicates the ArcGIS.Core.Data.FeatureClass to be modified.
    Exceptions
    Example
    Adding fields to a FeatureClass
    public void AddFieldsInFeatureClassSnippet(Geodatabase geodatabase)
    {
      // Adding following fields to the 'Parcels' FeatureClass
      // Global ID
      // Parcel_ID
      // Tax_Code
      // Parcel_Address
    
      // The FeatureClass to add fields
      string featureClassName = "Parcels";
    
      FeatureClassDefinition originalFeatureClassDefinition = geodatabase.GetDefinition<FeatureClassDefinition>(featureClassName);
      FeatureClassDescription originalFeatureClassDescription = new FeatureClassDescription(originalFeatureClassDefinition);
    
      // The four new fields to add on the 'Parcels' FeatureClass
      FieldDescription globalIdField = FieldDescription.CreateGlobalIDField();
      FieldDescription parcelIdDescription = new FieldDescription("Parcel_ID", FieldType.GUID);
      FieldDescription taxCodeDescription = FieldDescription.CreateIntegerField("Tax_Code");
      FieldDescription addressDescription = FieldDescription.CreateStringField("Parcel_Address", 150);
    
      List<FieldDescription> fieldsToAdd = new List<FieldDescription> { globalIdField, parcelIdDescription,
        taxCodeDescription, addressDescription };
    
      // Add new fields on the new FieldDescription list
      List<FieldDescription> modifiedFieldDescriptions = new List<FieldDescription>(originalFeatureClassDescription.FieldDescriptions);
      modifiedFieldDescriptions.AddRange(fieldsToAdd);
    
      // The new FeatureClassDescription with additional fields
      FeatureClassDescription modifiedFeatureClassDescription = new FeatureClassDescription(originalFeatureClassDescription.Name,
        modifiedFieldDescriptions, originalFeatureClassDescription.ShapeDescription);
    
      SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
      // Update the 'Parcels' FeatureClass with newly added fields
      schemaBuilder.Modify(modifiedFeatureClassDescription);
      bool modifyStatus = schemaBuilder.Build();
    
      if (!modifyStatus)
      {
        IReadOnlyList<string> errors = schemaBuilder.ErrorMessages;
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also