Gets a collection of the column names making up the index.

Namespace:  ESRI.ArcGISExplorer.Data

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public ReadOnlyCollection<string> GetColumnNames()
Visual Basic (Declaration)
Public Function GetColumnNames As ReadOnlyCollection(Of String)

Return Value

A ReadOnlyCollection object consisting of the names of the columns used in the index.

Examples

The code below demonstrates how to create a new composite index on three columns in a file geodatabase feature class. A new Index object is created with the class constructor arguments specifying the name of the index and the names of the columns to index. The Index object is then added to the IndexCollection to create the index on disk and the properties of the Index object are printed out, including the names of the columns which participate in the index using the GetColumnNames method.
CopyC#
{
  //Open the countries file geodatabase feature class
  Table countriesTable = Table.OpenFileGeodatabaseTable(@"C:\Data\World.gdb","countries");

  //Get the IndexCollection
  IndexCollection indexes = countriesTable.Indexes;

  //Create string array of columns that will make up the composite index
  string[] columnsToIndex = {"Name", "Region", "Continent"};

  //Create a new Index object
  Index compositeIndex = new Index("idx_Composite", columnsToIndex);

  try
  {
    //Add the Index to the IndexCollection thereby creating it on disk.
    indexes.Add(compositeIndex);

    //Print out the index properties
    System.Diagnostics.Debug.Print(compositeIndex.Name);                     //Prints "idx_Composite"
    System.Diagnostics.Debug.Print(compositeIndex.IsAscending.ToString());   //Prints "True"
    System.Diagnostics.Debug.Print(compositeIndex.IsUnique.ToString());      //Prints "False"
    foreach (string columnName in compositeIndex.GetColumnNames())
    {
      System.Diagnostics.Debug.Print(columnName);                       
    }

    //Prints: 
    //"Name"
    //"Region"
    //Continent

  }
  catch (Exception ex)
  {
    System.Diagnostics.Debug.Print(ex.Message);
  }
}
CopyVB.NET
'Open the countries file geodatabase feature class
Dim countriesTable As Table = Table.OpenFileGeodatabaseTable("C:\Data\World.gdb", "countries")

'Get the IndexCollection
Dim indexes As IndexCollection = countriesTable.Indexes

'Create string array of columns that will make up the composite index
Dim columnsToIndex As String() = {"Name", "Region", "Continent"}

'Create a new Index object
Dim compositeIndex As Index = New Index("idx_Composite", columnsToIndex)

Try
  'Add the Index to the IndexCollection thereby creating it on disk.
  indexes.Add(compositeIndex)

  'Print out the index properties
  System.Diagnostics.Debug.Print(compositeIndex.Name)                     'Prints "idx_Composite"
  System.Diagnostics.Debug.Print(compositeIndex.IsAscending.ToString())   'Prints "True"
  System.Diagnostics.Debug.Print(compositeIndex.IsUnique.ToString())      'Prints "False"


  For Each columnName As String In compositeIndex.GetColumnNames()
    System.Diagnostics.Debug.Print(columnName)
  Next

  'Prints: 
  '"Name"
  '"Region"
  'Continent


Catch ex As Exception
  System.Diagnostics.Debug.Print(ex.Message)
End Try

See Also