ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data Namespace / FeatureDataset Class / GetDefinition Method / GetDefinition<T>(String) Method
The type of dataset definition.
The name of the dataset.
Example

In This Topic
    GetDefinition<T>(String) Method
    In This Topic
    Gets a specific Definition instance associated with name of type T in the feature dataset. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public T GetDefinition<T>( 
       string name
    )
    where T: Definition
    Public Overloads Function GetDefinition(Of T As Definition)( _
       ByVal name As String _
    ) As T

    Parameters

    name
    The name of the dataset.

    Type Parameters

    T
    The type of dataset definition.

    Return Value

    A specific Definition instance corresponding to type T.
    Exceptions
    ExceptionDescription

    Using AttributedRelationshipClassDefinition as T to open a definition whose type is actually RelationshipClassDefinition.

    -or-

    The DatasetType corresponding to type T is not supported.

    name is invalid (e.g., a null value or an empty string).
    A geodatabase-related exception has occurred.
    Example
    Iterate datasets inside a feature dataset
    public void IterateDatasetsFromAFeatureDataset(Geodatabase geodatabase, string featureDatasetName = "City", string featureClassInFeatureDataset = "Buildings")
    {
        // Open a feature dataset
        using (FeatureDataset cityFeatureDataset = geodatabase.OpenDataset<FeatureDataset>(featureDatasetName))
        {
            // Get a feature class definition from a feature dataset
            FeatureClassDefinition buildingsFeatureClassDefinition = cityFeatureDataset.GetDefinition<FeatureClassDefinition>(featureClassInFeatureDataset);
    
            // Iterate dataset definition
            IReadOnlyList<FeatureClassDefinition> cityFeatureClassDefinitions = cityFeatureDataset.GetDefinitions<FeatureClassDefinition>();
            foreach (FeatureClassDefinition cityFeatureClassDefinition in cityFeatureClassDefinitions)
            {
                // Use feature class definition
            }
        }
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also