ArcGIS Pro 3.7 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 Function GetName() As String
    public string GetName()

    Return Value

    The name of the definition.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    Example
    Obtaining List of Definitions from Geodatabase
    {
      await 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 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also