The DataColumn Class
This class represents one column in the structure of a DataTable.
This class has no constructors; DataColumn objects are not user-creatable. Rather, whenever a DataTable is created, all of its DataColumn objects are created, as well.
You can access a data table's columns through its Columns property. For
example:
// Obtain a data table somehow. DataTable tbl = new DataTable(connection, 'SELECT * FROM Table1'); // Display the names and data types of all of the columns. foreach (DataColumn column in tbl.Columns) Print(column.Name, column.DataType);Here are the properties and methods of the DataColumn class:
int ColumnIndex { get; }
This read-only property gives the index of this column within its parent data table. The first column is at index zero.
Type DataType { get; }
This read-only property gives the type of data that can be stored this column.