Initializes a new instance of the Index class which can be used to create a new, single-column index on disk when it is added to the IndexCollection. This constructor applies to file geodatabase tables/feature classes or shapefiles, but is particularly useful for shapefiles which do not support user-named indexes.

Namespace:  ESRI.ArcGISExplorer.Data

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

Syntax

C#
public Index(
	string columnName
)
Visual Basic (Declaration)
Public Sub New ( _
	columnName As String _
)

Parameters

columnName
Type: System..::.String

The name of the Column to Index.

Remarks

The following properties use their default values:

  • Name property is set to the name of the Column.
  • IsUnique property is set to falseFalsefalsefalse (False in Visual Basic).
  • IsAscending property is set to trueTruetruetrue (True in Visual Basic).

Examples

The code below demonstrates how to create a new index on a single column in a shapefile. A new Index object is created with the name of the column to index being specified in the class constructor. The Index object is then added to the IndexCollection to create the index on disk. The properties of the Index object are printed out.
CopyC#
{
  //Open the cities shapefile
  Table citiesTable = Table.OpenShapefile(@"C:\Data\World\Cities.shp");

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

  //Create a new Index object for the Name Column
  Index nameIndex = new Index("Name");

  try
  {
    //Add the Index to the IndexCollection thereby creating it on disk.
    //A file called cities.NAME.atx will be created in the C:\Data\World\ directory.
    indexes.Add(nameIndex);

    //Print out the index properties
    System.Diagnostics.Debug.Print(nameIndex.Name);                     //Prints "Name"
    System.Diagnostics.Debug.Print(nameIndex.IsAscending.ToString());   //Prints "True"
    System.Diagnostics.Debug.Print(nameIndex.IsUnique.ToString());      //Prints "False"
  }
  catch (Exception ex)
  {
    System.Diagnostics.Debug.Print(ex.Message);
  }
}
CopyVB.NET
'Open the cities shapefile
Dim citiesTable As Table = Table.OpenShapefile("C:\Data\World\Cities.shp")

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

'Create a new Index object for the Name Column
Dim nameIndex As Index = New Index("Name")

Try
  'Add the Index to the IndexCollection thereby creating it on disk.
  'A file called cities.NAME.atx will be created in the C:\Data\World\ directory.
  indexes.Add(nameIndex)

  'Print out the index properties
  System.Diagnostics.Debug.Print(nameIndex.Name)                     'Prints "Name"
  System.Diagnostics.Debug.Print(nameIndex.IsAscending.ToString())   'Prints "True"
  System.Diagnostics.Debug.Print(nameIndex.IsUnique.ToString())      'Prints "False"
Catch ex As Exception
  System.Diagnostics.Debug.Print(ex.Message)
End Try

See Also