ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.Raster Namespace / RasterDatasetDefinition Class / GetBandCount Method
Example Version

GetBandCount Method (RasterDatasetDefinition)
Gets the number of bands in the raster dataset. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public int GetBandCount()

Return Value

An integer representing the number of bands in the raster dataset.
Example
Get the raster dataset definition from a raster dataset
await QueuedTask.Run(() =>
{
  RasterDatasetDefinition rasterDatasetDefinition = rasterDataset.GetDefinition();

  // access the dataset definition properties
  rasterDatasetDefinition.GetBandCount();
});
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also