ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / FieldDescription Class / SetDefaultValue Method
The default value of the ArcGIS.Core.Data.Field.
The specific subtype code for the ArcGIS.Core.Data.Field's default value. This argument is optional. If it is not set or is set to null, the field's default value at the table level is set.
Example Version

SetDefaultValue Method
Sets the default value of the ArcGIS.Core.Data.Field at the table level if subtypeCode is not specified. Otherwise, sets the default value for the specific subtype code.
Syntax
public void SetDefaultValue( 
   object defaultValue,
   Nullable<int> subtypeCode
)

Parameters

defaultValue
The default value of the ArcGIS.Core.Data.Field.
subtypeCode
The specific subtype code for the ArcGIS.Core.Data.Field's default value. This argument is optional. If it is not set or is set to null, the field's default value at the table level is set.
Example
Modifying an existing field
private void ModifyExistingField(SchemaBuilder schemaBuilder, TableDefinition tableDefinition, string fieldNameToBeModified = "PropertyAddress")
{
    Field field = tableDefinition.GetFields().FirstOrDefault(f => f.Name.Contains(fieldNameToBeModified));

    // Update field's alias name and length
    FieldDescription fieldDescription = new FieldDescription(field)
    {
        AliasName = "Physical Property Address",
        Length = 50
    };

    // Update the default value
    fieldDescription.SetDefaultValue("123 Main St");

    // Enqueue modify operation
    schemaBuilder.Modify(new TableDescription(tableDefinition), field.Name, fieldDescription);

    // Execute DDL
    schemaBuilder.Build();
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3.1 or higher.
See Also