Gets a collection containing all columns in the Table.

Namespace:  ESRI.ArcGISExplorer.Data

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

Syntax

C#
public ColumnCollection Columns { get; }
Visual Basic (Declaration)
Public ReadOnly Property Columns As ColumnCollection

Field Value

A ColumnCollection object which contains Column objects each of which represents a set of data values of a particular ColumnType, one for each row of the Table.

Examples

The code below opens a file geodatabase feature class and shows how to loop over all the columns in the Table using two different approaches.
CopyC#
//Open the regions feature class stored in the Scotland file geodatabase
Geodatabase gdb = new Geodatabase(@"C:\Data\Scotland.gdb");
Table regionsTable = gdb.OpenTable("regions");

//return a collection containing all columns in the Regions table
ColumnCollection columns = regionsTable.Columns;

//Example 1 - use a for each loop to iterate over all columns in the Regions table
foreach (Column col in columns)
{
  //Print the name of each column
  System.Diagnostics.Debug.Print(col.Name);
  //Print the column type
  System.Diagnostics.Debug.Print(col.Type.ToString());
}

//Example 2 - alternative approach - use a for/next loop to access each column by index position
for (int i = 0; i < columns.Count; i++)
{
  Column col = columns[i];
  //Print the name of each column
  System.Diagnostics.Debug.Print(col.Name);
  //Print the column type
  System.Diagnostics.Debug.Print(col.Type.ToString());
}
CopyVB.NET
'Open regions feature class stored in the Scotland file geodatabase
Dim gdb As Geodatabase = New Geodatabase("C:\Data\Scotland.gdb")
Dim regionsTable As Table = gdb.OpenTable("regions")

'return a collection containing all columns in the Regions table
Dim columns As ColumnCollection = regionsTable.Columns

'Example 1 - use a for each loop to iterate over all columns in the Regions table
For Each col As Column In columns
  'Print the name of each column
  System.Diagnostics.Debug.Print(col.Name)
  'Print the column type
  System.Diagnostics.Debug.Print(col.Type.ToString())
Next

'Example 2 - alternative approach - use a for loop to access each column by index position
For i As Integer = 0 To columns.Count - 1
  Dim col As Column = columns.Item(i)
  'Print the name of each column
  System.Diagnostics.Debug.Print(col.Name)
  'Print the column type
  System.Diagnostics.Debug.Print(col.Type.ToString())
Next

See Also