How to create a feature class


This document was published with and applies to ArcGIS 9.3.
A 10 version also exists.
Summary Feature classes can exist as stand-alone entities at the workspace level of a geodatabase or within a feature dataset. The decision to create a feature class in a feature dataset or as a stand-alone feature class depends on the purpose of the feature class. Collections of spatially related feature classes are often grouped together in a feature dataset. If a topology is going to be used to manage how features share geometry, a geometric network is going to be built for a utility layer, a network dataset is going to be built for routing and optimization, or a terrain will be created. Feature classes must be created in a feature dataset.

Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo
Engine Developer Kit Engine Runtime: Geodatabase Update

To use the code in this topic, the following namespaces must be referenced via the using (C#) or Imports (VB .NET) statements. It is also necessary to add the corresponding references to the project to gain access to these application programming interfaces (APIs).

In this topic


Creating a stand-alone feature class

The IFeatureWorkspace.CreateFeatureClass method can be used to create a stand-alone feature class that is not part of a feature dataset. See the following code example:
 

[C#]
public IFeatureClass CreateStandaloneFeatureClass(IWorkspace workspace, String
  featureClassName, IFields fieldsCollection, String shapeFieldName)
{
  IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
  IFeatureClassDescription fcDesc = new FeatureClassDescriptionClass();
  IObjectClassDescription ocDesc = (IObjectClassDescription)fcDesc;

  // Use IFieldChecker to create a validated fields collection.
  IFieldChecker fieldChecker = new FieldCheckerClass();
  IEnumFieldError enumFieldError = null;
  IFields validatedFields = null;
  fieldChecker.ValidateWorkspace = workspace;
  fieldChecker.Validate(fieldsCollection, out enumFieldError, out
    validatedFields);

  // The enumFieldError enumerator can be inspected at this point to determine 
  // which fields were modified during validation.
  IFeatureClass featureClass = featureWorkspace.CreateFeatureClass
    (featureClassName, validatedFields, ocDesc.InstanceCLSID,
    ocDesc.ClassExtensionCLSID, esriFeatureType.esriFTSimple, shapeFieldName, 
    "");
  return featureClass;
}

[VB.NET]
Public Function CreateStandaloneFeatureClass(ByVal workspace As IWorkspace, ByVal featureClassName As String, ByVal fieldsCollection As IFields, ByVal shapeFieldName As String) As IFeatureClass
    Dim featureWorkspace As IFeatureWorkspace = CType(workspace, IFeatureWorkspace)
    Dim fcDesc As IFeatureClassDescription = New FeatureClassDescriptionClass()
    Dim ocDesc As IObjectClassDescription = CType(fcDesc, IObjectClassDescription)
    
    ' Use IFieldChecker to create a validated fields collection.
    Dim fieldChecker As IFieldChecker = New FieldCheckerClass()
    Dim enumFieldError As IEnumFieldError = Nothing
    Dim validatedFields As IFields = Nothing
    fieldChecker.ValidateWorkspace = workspace
    fieldChecker.Validate(fieldsCollection, enumFieldError, validatedFields)
    
    ' The enumFieldError enumerator can be inspected at this point to determine
    ' which fields were modified during validation.
    Dim featureClass As IFeatureClass = featureWorkspace.CreateFeatureClass(featureClassName, validatedFields, ocDesc.InstanceCLSID, ocDesc.ClassExtensionCLSID, esriFeatureType.esriFTSimple, shapeFieldName, "")
    Return featureClass
End Function
How to obtain correct parameter values for IFeatureWorkspace.CreateFeatureClass is explained in the CreateFeatureClass parameters section in this topic.
 
For more information on how to connect to a workspace, see How to connect to a geodatabase. For steps on how to create a new geodatabase, see How to create new geodatabases.
While similar to the IFeatureWorkspace.CreateTable method, CreateFeatureClass has the following additional parameters:
  • FeatureType parameter that specifies the category of features to be stored in this feature class (such as esriFTSimple, esriFTComplexEdgeFeature, and so on)
  • ShapeFieldName corresponding to the name of shape field (shapeFieldName identifies the name of the field of type Geometry in the input fields collection that represents the shape field for the feature class)

Creating a feature class in a feature dataset

Feature classes with a spatial or thematic relationship are generally grouped together in a feature dataset. Storing feature classes in a feature dataset allows them to participate in a topology to manage their shared geometry, a network to control their connectivity and perform network analysis, or a terrain so they can be used for surface generation and analysis.
 
Use the IFeatureDataset.CreateFeatureClass method to create new feature classes in feature datasets. The arguments to this method are almost identical to IFeatureWorkspace.CreateFeatureClass, except the IFeatureDataset method requires the spatial reference of the feature class match that of the containing feature dataset. See the following code example:
 

[C#]
public IFeatureClass CreateFeatureDatasetFeatureClass(IFeatureDataset
  featureDataset, String featureClassName, IFields fieldsCollection, String
  shapeFieldName)
{
  IFeatureClassDescription fcDesc = new FeatureClassDescriptionClass();
  IObjectClassDescription ocDesc = (IObjectClassDescription)fcDesc;

  // Use IFieldChecker to create a validated fields collection.
  IFieldChecker fieldChecker = new FieldCheckerClass();
  IEnumFieldError enumFieldError = null;
  IFields validatedFields = null;
  fieldChecker.ValidateWorkspace = featureDataset.Workspace;
  fieldChecker.Validate(fieldsCollection, out enumFieldError, out
    validatedFields);

  // The enumFieldError enumerator can be inspected at this point to determine 
  // which fields were modified during validation.
  IFeatureClass featureClass = featureDataset.CreateFeatureClass
    (featureClassName, validatedFields, ocDesc.InstanceCLSID,
    ocDesc.ClassExtensionCLSID, esriFeatureType.esriFTSimple,
    fcDesc.ShapeFieldName, "");
  return featureClass;
}

[VB.NET]
Public Function CreateFeatureDatasetFeatureClass(ByVal featureDataset As IFeatureDataset, ByVal featureClassName As String, ByVal fieldsCollection As IFields, ByVal shapeFieldName As String) As IFeatureClass
    Dim fcDesc As IFeatureClassDescription = New FeatureClassDescriptionClass()
    Dim ocDesc As IObjectClassDescription = CType(fcDesc, IObjectClassDescription)
    
    ' Use IFieldChecker to create a validated fields collection.
    Dim fieldChecker As IFieldChecker = New FieldCheckerClass()
    Dim enumFieldError As IEnumFieldError = Nothing
    Dim validatedFields As IFields = Nothing
    fieldChecker.ValidateWorkspace = featureDataset.Workspace
    fieldChecker.Validate(fieldsCollection, enumFieldError, validatedFields)
    
    ' The enumFieldError enumerator can be inspected at this point to determine
    ' which fields were modified during validation.
    Dim featureClass As IFeatureClass = featureDataset.CreateFeatureClass(featureClassName, validatedFields, ocDesc.InstanceCLSID, ocDesc.ClassExtensionCLSID, esriFeatureType.esriFTSimple, fcDesc.ShapeFieldName, "")
    Return featureClass
End Function
How to obtain correct parameter values for IFeatureWorkspace.CreateFeatureClass is explained in the CreateFeatureClass Parameters section in this topic.
 
For steps on how to create a new feature dataset, see How to create a feature dataset.

Using IFieldChecker for field validation

Attempting to create a feature class with invalid field names result in an error being raised when the IFeatureWorkspace.CreateFeatureClass or IFeatureDataset.CreateFeatureClass methods are called. The IFieldChecker interface provides data source-specific validation for fields collections. The IFieldChecker.Validate method takes a collection of fields as an input parameter and returns a field error enumerator and a validated fields collection as output parameters. Prior to calling Validate, the ValidateWorkspace property must first be set to the workspace where the fields will be created.
 
The following are the four types of field name errors:
 
Most of the examples in this topic show how to use the IFieldChecker interface when creating a feature class. For more information, see the IFieldChecker, IEnumFieldError, and IFieldError interfaces.

CreateFeatureClass parameters

The following subsections describe setting the properties of a new feature class with the parameters of the CreateFeatureClass method. For more information about the properties of a feature class, see the following ArcGIS Desktop Help topics:
 
Feature class name
A feature class name identifies the feature class in the geodatabase. Make sure the name of the feature class is unique before calling CreateFeatureClass; this can be done by using the IWorkspace2.NameExists property (for geodatabase data sources only).
 
To verify that a name is appropriate for a specific workspace (as different data sources have different restrictions on names), use the IFieldChecker.ValidateTableName method. This method does not check if a dataset of the same name already exists, only whether the name is a reserved word, if it contains an invalid character, or if it has an invalid starting character. Some naming conventions are not allowed in any geodatabase—for example, using a number as the first character of a dataset name—while others are restricted due to the underlying database management system (DBMS).
 
Feature class fields
Each feature class has a collection of fields, which are the components that provide structure for the feature class. Each feature class must have at least two fields: ObjectID and Shape. The IFields, IField, and IFieldEdit interfaces can be used to create and populate the set of fields for a feature class, and the RequiredFields property of the IObjectClassDescription interface can be used to obtain a collection of predefined required fields.
 
For feature classes, RequiredFields returns a field collection containing the ObjectID field and a Shape field with a geometry type of polygon. To add more fields to a new or existing feature class, see How to create new fields.
When creating a feature class with the same fields as an existing feature class, do not pass the Fields object from the existing class into the CreateFeatureClass method. Rather, cast the object to the IClone interface, clone it, and pass the resulting Fields object into the CreateFeatureClass method.
Set up the GeometryDef property of the Shape field with a GeometryDef object (using the IGeometryDef interface) containing the spatial and geometry information for the feature class. This information includes the following:
 
Feature classes created in a feature dataset inherit the spatial reference of the containing feature dataset. Therefore, the spatial reference does not need to be specified in the GeometryDef object. If the fields collection is obtained from the RequiredFields property, GeometryDef information can be modified.
 
When creating stand-alone feature classes, the GeometryDef object must be fully set up with information on the spatial reference (the projected or geographic coordinate system plus the vertical coordinate system if needed, the coordinate domain, and the coordinate resolution). For steps on how to create a predefined spatial reference object, see How to create a predefined spatial reference.  
 
There is a vast array of predefined spatial reference systems based on the values from the European Petroleum Survey Group's (EPSG) database (http://www.epsg.org), which is becoming an industry standard.
 
If different releases of the geodatabase are used, see How to construct a high- or low-precision spatial reference , which discusses how to create spatial references in ArcGIS 9.2 and later geodatabases as well as in pre-9.2 geodatabases.
 
If a coordinate system with custom properties is needed, see How to create a custom geographic coordinate system and How to create a custom projected coordinate system that explains how this can be accomplished. 
 
CLSID and EXTCLSID
The class identifier (CLSID) parameter is used to specify the globally unique identifier (GUID) to instantiate the object representing a feature in that feature class. If null or nothing is passed in for the CLSID, the geodatabase will assign it the CLSID of esriGeodatabase.Feature, which in most cases is acceptable. If the feature class is being created to store objects other than instances of Feature, the instance class's GUID can be passed in at creation time or methods from the IClassSchemaEdit interface can be called to provide later.
 
The extension class identifier (EXTCLSID) parameter specifies the GUID to use to instantiate the object and class extension behavior for the feature class extension (IFeatureClassExtension). This object must at least support the IClassExtension interface. If a null value is provided for the EXTCLSID, the new feature class will not have an extension.
 
Since class extensions are not required, this is usually acceptable unless a class extension is explicitly needed, or the feature class being created is a dimension feature class. If the feature class should have a class extension and the GUID of the class extension the class extension is known, it can be passed in at this time or methods can be called on the feature class's IClassSchemaEdit interface at a later time.
 
Feature type
The feature type parameter specifies the category type of features stored in the feature class. In most cases, the esriFTSimple value of the esriFeatureType enumeration should be used—esriFTSimple specifies that the class will contain simple features, such as points, polylines, and polygons.
 
Classes that contain feature types other than simple features (esriFTSimple) or dimension features (esriFTDimension) should not be created with the IFeatureWorkspace.CreateFeatureClass and IFeatureDataset.CreateFeatureClass methods. For example, annotation classes should be created using the IAnnotationLayerFactory interface, and raster catalogs should be created using the IRasterWorkspaceEx interface.
Shape field name
The Shape field name identifies the name of the field of type geometry in the fields collection that represents the Shape field of the feature class.
 
Configuration keyword
The optional configuration keywordparameter allows the application to control the physical layout for this table in the underlying relational database management system (RDBMS) or file geodatabase—for example, in the case of an Oracle database, the configuration keyword controls the table space where the table is created, as well as the initial and next extents, and other properties. 
 
The configuration keywords for an ArcSDE instance are set up by the ArcSDE data administrator. The list of available keywords supported by a workspace can be obtained using the IWorkspaceConfiguration interface. For more information on configuration keywords, refer to the ArcSDE documentation.
 
The configuration keywords for a file geodatabase are predefined. In most cases, the Defaults keyword should be used.

Additional code examples

The following code example shows how to create a feature class using an instance of the FeatureClassDescription class, with an additional field added to the required fields collection.
 

[C#]
public IFeatureClass CreateFeatureClassWithFields(String featureClassName,
  IFeatureWorkspace featureWorkspace)
{
  // Instantiate a feature class description to get the required fields.
  IFeatureClassDescription fcDescription = new FeatureClassDescriptionClass();
  IObjectClassDescription ocDescription = (IObjectClassDescription)
    fcDescription;
  IFields fields = ocDescription.RequiredFields;
  IFieldsEdit fieldsEdit = (IFieldsEdit)fields;

  // Add a Name text field to the required fields.
  IField field = new FieldClass();
  IFieldEdit fieldEdit = (IFieldEdit)field;
  fieldEdit.Name_2 = "Name";
  fieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
  fieldsEdit.AddField(field);

  // Use IFieldChecker to create a validated fields collection.
  IFieldChecker fieldChecker = new FieldCheckerClass();
  IEnumFieldError enumFieldError = null;
  IFields validatedFields = null;
  fieldChecker.ValidateWorkspace = (IWorkspace)featureWorkspace;
  fieldChecker.Validate(fields, out enumFieldError, out validatedFields);

  // The enumFieldError enumerator can be inspected at this point to determine 
  // which fields were modified during validation.

  // Create the feature class.
  IFeatureClass featureClass = featureWorkspace.CreateFeatureClass
    (featureClassName, validatedFields, ocDescription.InstanceCLSID,
    ocDescription.ClassExtensionCLSID, esriFeatureType.esriFTSimple,
    fcDescription.ShapeFieldName, "");
  return featureClass;
}

[VB.NET]
Public Function CreateFeatureClassWithFields(ByVal featureClassName As String, _
                                             ByVal featureWorkspace As IFeatureWorkspace) As IFeatureClass
    ' Instantiate a feature class description to get the required fields.
    Dim fcDescription As IFeatureClassDescription = New FeatureClassDescriptionClass()
    Dim ocDescription As IObjectClassDescription = CType(fcDescription, IObjectClassDescription)
    Dim fields As IFields = ocDescription.RequiredFields
    Dim fieldsEdit As IFieldsEdit = CType(fields, IFieldsEdit)
    
    ' Add a Name text field to the required fields.
    Dim field As IField = New FieldClass()
    Dim fieldEdit As IFieldEdit = CType(field, IFieldEdit)
    fieldEdit.Name_2 = "Name"
    fieldEdit.Type_2 = esriFieldType.esriFieldTypeString
    fieldsEdit.AddField(field)
    
    ' Use IFieldChecker to create a validated fields collection.
    Dim fieldChecker As IFieldChecker = New FieldCheckerClass()
    Dim enumFieldError As IEnumFieldError = Nothing
    Dim validatedFields As IFields = Nothing
    fieldChecker.ValidateWorkspace = CType(featureWorkspace, IWorkspace)
    fieldChecker.Validate(fields, enumFieldError, validatedFields)
    
    ' The enumFieldError enumerator can be inspected at this point to determine
    ' which fields were modified during validation.
    
    ' Create the feature class.
    Dim featureClass As IFeatureClass = featureWorkspace.CreateFeatureClass(featureClassName, validatedFields, _
                                        ocDescription.InstanceCLSID, ocDescription.ClassExtensionCLSID, esriFeatureType.esriFTSimple, _
                                        fcDescription.ShapeFieldName, "")
    Return featureClass
End Function
The following code example shows how to generate a feature class using a feature class description, but rather than using the default GeometryDef associated with the Shape field, it modifies the GeometryDef to apply a spatial reference as well as a new geometry type (esriGeometryType.esriGeometryPoint). By default, a feature class has an unknown coordinate system and polygonal geometry.
 

[C#]
public IFeatureClass CreateFeatureClassWithSR(String featureClassName,
  IFeatureWorkspace featureWorkspace, ISpatialReference spatialReference)
{
  // Instantiate a feature class description to get the required fields.
  IFeatureClassDescription fcDescription = new FeatureClassDescriptionClass();
  IObjectClassDescription ocDescription = (IObjectClassDescription)
    fcDescription;
  IFields fields = ocDescription.RequiredFields;

  // Find the shape field in the required fields and modify its GeometryDef to
  // use point geometry and to set the spatial reference.
  int shapeFieldIndex = fields.FindField(fcDescription.ShapeFieldName);
  IField field = fields.get_Field(shapeFieldIndex);
  IGeometryDef geometryDef = field.GeometryDef;
  IGeometryDefEdit geometryDefEdit = (IGeometryDefEdit)geometryDef;
  geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint;
  geometryDefEdit.SpatialReference_2 = spatialReference;

  // In this example, only the required fields from the class description are used as fields
  // for the feature class. If additional fields are added, use IFieldChecker to
  // validate them.

  // Create the feature class.
  IFeatureClass featureClass = featureWorkspace.CreateFeatureClass
    (featureClassName, fields, ocDescription.InstanceCLSID,
    ocDescription.ClassExtensionCLSID, esriFeatureType.esriFTSimple,
    fcDescription.ShapeFieldName, "");
  return featureClass;
}

[VB.NET]
Public Function CreateFeatureClassWithSR(ByVal featureClassName As String, _
                                         ByVal featureWorkspace As IFeatureWorkspace, ByVal spatialReference As ISpatialReference) As IFeatureClass
    ' Instantiate a feature class description to get the required fields.
    Dim fcDescription As IFeatureClassDescription = New FeatureClassDescriptionClass()
    Dim ocDescription As IObjectClassDescription = CType(fcDescription, IObjectClassDescription)
    Dim fields As IFields = ocDescription.RequiredFields
    
    ' Find the shape field in the required fields and modify its GeometryDef to
    ' use point geometry and to set the spatial reference.
    Dim shapeFieldIndex As Integer = fields.FindField(fcDescription.ShapeFieldName)
    Dim field As IField = fields.Field(shapeFieldIndex)
    Dim geometryDef As IGeometryDef = field.GeometryDef
    Dim geometryDefEdit As IGeometryDefEdit = CType(geometryDef, IGeometryDefEdit)
    geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint
    geometryDefEdit.SpatialReference_2 = spatialReference
    
    ' In this example, only the required fields from the class description are used as fields
    ' for the feature class. If additional fields are added, use IFieldChecker to
    ' validate them.
    
    ' Create the feature class.
    Dim featureClass As IFeatureClass = featureWorkspace.CreateFeatureClass(featureClassName, fields, _
                                        ocDescription.InstanceCLSID, ocDescription.ClassExtensionCLSID, esriFeatureType.esriFTSimple, _
                                        fcDescription.ShapeFieldName, "")
    Return featureClass
End Function
The following code example shows how to create a feature class without using the FeatureClassDescription class. A feature class must contain Object ID and Shape fields, but their names need not be OBJECTID and Shape (the default names). The classExtensionUID parameter allows a class extension to be set using the method; passing null (in C#) or Nothing (in VB .NET) indicates no class extension should be used.
 

[C#]
public IFeatureClass CreateWithoutDescription(String featureClassName, UID
  classExtensionUID, IFeatureWorkspace featureWorkspace)
{
  // Create a fields collection for the feature class.
  IFields fields = new FieldsClass();
  IFieldsEdit fieldsEdit = (IFieldsEdit)fields;

  // Add an Object ID field to the fields collection. This is mandatory for feature classes.
  IField oidField = new FieldClass();
  IFieldEdit oidFieldEdit = (IFieldEdit)oidField;
  oidFieldEdit.Name_2 = "OID";
  oidFieldEdit.Type_2 = esriFieldType.esriFieldTypeOID;
  fieldsEdit.AddField(oidField);

  // Create a geometry definition (and spatial reference) for the feature class.
  IGeometryDef geometryDef = new GeometryDefClass();
  IGeometryDefEdit geometryDefEdit = (IGeometryDefEdit)geometryDef;
  geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint;
  ISpatialReferenceFactory spatialReferenceFactory = new
    SpatialReferenceEnvironmentClass();
  ISpatialReference spatialReference =
    spatialReferenceFactory.CreateProjectedCoordinateSystem((int)
    esriSRProjCSType.esriSRProjCS_NAD1983UTM_20N);
  ISpatialReferenceResolution spatialReferenceResolution = 
    (ISpatialReferenceResolution)spatialReference;
  spatialReferenceResolution.ConstructFromHorizon();
  spatialReferenceResolution.SetDefaultXYResolution();
  ISpatialReferenceTolerance spatialReferenceTolerance = 
    (ISpatialReferenceTolerance)spatialReference;
  spatialReferenceTolerance.SetDefaultXYTolerance();
  geometryDefEdit.SpatialReference_2 = spatialReference;

  // Add a geometry field to the fields collection. This is where the geometry definition is applied.
  IField geometryField = new FieldClass();
  IFieldEdit geometryFieldEdit = (IFieldEdit)geometryField;
  geometryFieldEdit.Name_2 = "Shape";
  geometryFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;
  geometryFieldEdit.GeometryDef_2 = geometryDef;
  fieldsEdit.AddField(geometryField);

  // Create a Name text field for the fields collection.
  IField nameField = new FieldClass();
  IFieldEdit nameFieldEdit = (IFieldEdit)nameField;
  nameFieldEdit.Name_2 = "Name";
  nameFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
  nameFieldEdit.Length_2 = 20;
  fieldsEdit.AddField(nameField);

  // Use IFieldChecker to create a validated fields collection.
  IFieldChecker fieldChecker = new FieldCheckerClass();
  IEnumFieldError enumFieldError = null;
  IFields validatedFields = null;
  fieldChecker.ValidateWorkspace = (IWorkspace)featureWorkspace;
  fieldChecker.Validate(fields, out enumFieldError, out validatedFields);

  // The enumFieldError enumerator can be inspected at this point to determine 
  // which fields were modified during validation.

  // Create the feature class. Note that the CLSID parameter is null—this indicates to use the
  // default CLSID, esriGeodatabase.Feature (acceptable in most cases for feature classes).
  IFeatureClass featureClass = featureWorkspace.CreateFeatureClass
    (featureClassName, validatedFields, null, classExtensionUID,
    esriFeatureType.esriFTSimple, "Shape", "");
  return featureClass;
}

[VB.NET]
Public Function CreateWithoutDescription(ByVal featureClassName As String, ByVal classExtensionUID As UID, _
                                         ByVal featureWorkspace As IFeatureWorkspace) As IFeatureClass
    ' Create a fields collection for the feature class.
    Dim fields As IFields = New FieldsClass()
    Dim fieldsEdit As IFieldsEdit = CType(fields, IFieldsEdit)
    
    ' Add an Object ID field to the fields collection. This is mandatory for feature classes.
    Dim oidField As IField = New FieldClass()
    Dim oidFieldEdit As IFieldEdit = CType(oidField, IFieldEdit)
    oidFieldEdit.Name_2 = "OID"
    oidFieldEdit.Type_2 = esriFieldType.esriFieldTypeOID
    fieldsEdit.AddField(oidField)
    
    ' Create a geometry definition (and spatial reference) for the feature class.
    Dim geometryDef As IGeometryDef = New GeometryDefClass()
    Dim geometryDefEdit As IGeometryDefEdit = CType(geometryDef, IGeometryDefEdit)
    geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint
    Dim spatialReferenceFactory As ISpatialReferenceFactory = New SpatialReferenceEnvironmentClass()
    Dim spatialReference As ISpatialReference = _
                                                spatialReferenceFactory.CreateProjectedCoordinateSystem(CType(esriSRProjCSType.esriSRProjCS_NAD1983UTM_20N, Integer))
    Dim spatialReferenceResolution As ISpatialReferenceResolution = CType(spatialReference, ISpatialReferenceResolution)
    spatialReferenceResolution.ConstructFromHorizon()
    spatialReferenceResolution.SetDefaultXYResolution()
    Dim spatialReferenceTolerance As ISpatialReferenceTolerance = CType(spatialReference, ISpatialReferenceTolerance)
    spatialReferenceTolerance.SetDefaultXYTolerance()
    geometryDefEdit.SpatialReference_2 = spatialReference
    
    ' Add a geometry field to the fields collection. This is where the geometry definition is applied.
    Dim geometryField As IField = New FieldClass()
    Dim geometryFieldEdit As IFieldEdit = CType(geometryField, IFieldEdit)
    geometryFieldEdit.Name_2 = "Shape"
    geometryFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry
    geometryFieldEdit.GeometryDef_2 = geometryDef
    fieldsEdit.AddField(geometryField)
    
    ' Create a Name text field for the fields collection.
    Dim nameField As IField = New FieldClass()
    Dim nameFieldEdit As IFieldEdit = CType(nameField, IFieldEdit)
    nameFieldEdit.Name_2 = "Name"
    nameFieldEdit.Type_2 = esriFieldType.esriFieldTypeString
    nameFieldEdit.Length_2 = 20
    fieldsEdit.AddField(nameField)
    
    ' Use IFieldChecker to create a validated fields collection.
    Dim fieldChecker As IFieldChecker = New FieldCheckerClass()
    Dim enumFieldError As IEnumFieldError = Nothing
    Dim validatedFields As IFields = Nothing
    fieldChecker.ValidateWorkspace = CType(featureWorkspace, IWorkspace)
    fieldChecker.Validate(fields, enumFieldError, validatedFields)
    
    ' The enumFieldError enumerator can be inspected at this point to determine
    ' which fields were modified during validation.
    
    ' Create the feature class. Note that the CLSID parameter is null—this indicates to use the
    ' default CLSID, esriGeodatabase.Feature (acceptable in most cases for feature classes).
    Dim featureClass As IFeatureClass = featureWorkspace.CreateFeatureClass(featureClassName, validatedFields, _
                                        Nothing, classExtensionUID, esriFeatureType.esriFTSimple, "Shape", "")
    Return featureClass
End Function


See Also:

How to create an object class
How to create new fields
How to create a feature dataset