ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / SchemaBuilder Class / Create Method / Create(FeatureClassDescription) Method
Indicates the ArcGIS.Core.Data.FeatureClass to be created.
Example

In This Topic
    Create(FeatureClassDescription) Method
    In This Topic
    Enqueue the create operation on the object referred to by the FeatureClassDescription. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    featureClassDescription
    Indicates the ArcGIS.Core.Data.FeatureClass to be created.

    Return Value

    Exceptions
    ExceptionDescription
    The total path length for the ArcGIS.Core.Data.FeatureClass to be created must be less than 252 characters.
    featureClassDescription is null.
    A Geodatabase must be set as the datasource for this operation
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Creating a feature class
    public void CreateFeatureClassSnippet(Geodatabase geodatabase, FeatureClass existingFeatureClass, SpatialReference spatialReference)
    {
        // Create a Cities feature class with the following fields
        //  GlobalID
        //  ObjectID
        //  Name (string)
        //  Population (integer)
    
        // This static helper routine creates a FieldDescription for a GlobalID field with default values
        FieldDescription globalIDFieldDescription = FieldDescription.CreateGlobalIDField();
    
        // This static helper routine creates a FieldDescription for an ObjectID field with default values
        FieldDescription objectIDFieldDescription = FieldDescription.CreateObjectIDField();
    
        // This static helper routine creates a FieldDescription for a string field
        FieldDescription nameFieldDescription = FieldDescription.CreateStringField("Name", 255);
    
        // This static helper routine creates a FieldDescription for an integer field
        FieldDescription populationFieldDescription = FieldDescription.CreateIntegerField("Population");
    
        // Assemble a list of all of our field descriptions
        List<FieldDescription> fieldDescriptions = new List<FieldDescription>()
    { globalIDFieldDescription, objectIDFieldDescription, nameFieldDescription, populationFieldDescription };
    
        // Create a ShapeDescription object
        ShapeDescription shapeDescription = new ShapeDescription(GeometryType.Point, spatialReference);
    
        // Alternatively, ShapeDescriptions can be created from another feature class.  In this case, the new feature class will inherit the same shape properties of the existing class
        ShapeDescription alternativeShapeDescription = new ShapeDescription(existingFeatureClass.GetDefinition());
    
        // Create a FeatureClassDescription object to describe the feature class to create
        FeatureClassDescription featureClassDescription =
          new FeatureClassDescription("Cities", fieldDescriptions, shapeDescription);
    
        // Create a SchemaBuilder object
        SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
        // Add the creation of the Cities feature class to our list of DDL tasks
        schemaBuilder.Create(featureClassDescription);
    
        // Execute the DDL
        bool success = schemaBuilder.Build();
    
        // Inspect error messages
        if (!success)
        {
            IReadOnlyList<string> errorMessages = schemaBuilder.ErrorMessages;
            //etc.
        }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also