ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data Namespace / Definition Class / GetName Method
Example

In This Topic
    GetName Method (Definition)
    In This Topic
    Gets the name of the definition. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public string GetName()
    Public Function GetName() As String

    Return Value

    The name of the definition.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    Example
    Obtaining List of Defintions from Geodatabase
    public async Task ObtainingDefinitionsFromGeodatabase()
    {
      await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
      {
        using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri("path\\to\\sde\\file\\sdefile.sde"))))
        {
          IReadOnlyList<FeatureClassDefinition> enterpriseDefinitions = geodatabase.GetDefinitions<FeatureClassDefinition>();
          IEnumerable<Definition> featureClassesHavingGlobalID = enterpriseDefinitions.Where(definition => definition.HasGlobalID());
    
          IReadOnlyList<FeatureDatasetDefinition> featureDatasetDefinitions = geodatabase.GetDefinitions<FeatureDatasetDefinition>();
          bool electionRelatedFeatureDatasets = featureDatasetDefinitions.Any(definition => definition.GetName().Contains("Election"));
    
          IReadOnlyList<AttributedRelationshipClassDefinition> attributedRelationshipClassDefinitions = geodatabase.GetDefinitions<AttributedRelationshipClassDefinition>();
    
          IReadOnlyList<RelationshipClassDefinition> relationshipClassDefinitions = geodatabase.GetDefinitions<RelationshipClassDefinition>();
        }
      });
    }
    Access the bands in a raster dataset
    var count = rasterDataset.GetBandCount();
    RasterBand rasterBandByName = rasterDataset.GetBandByName(sBandName);
    var index = rasterDataset.GetBandIndex(sBandName);
    
    // Get a RasterBand from the raster dataset
    RasterBand rasterBand = rasterDataset.GetBand(0);
    
    // Get the RasterBandDefinition from the raster band.
    RasterBandDefinition rasterBandDefinition = rasterBand.GetDefinition();
    // Get the name of the raster band from the raster band.
    string bandName = rasterBandDefinition.GetName();
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also