NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

ColumnsCollection.Item (String)

Gets the column from the collection with the specified name.

[C#] In C#, this member is the indexer for the ColumnsCollection class.

[Visual Basic]
Overloads Overridable Public Default ReadOnly Property Item( _
   ByVal name As String _
) As DataColumn
[C#]
public DataColumn this[
   string name
] {virtual get;}
[C++]
public: __property virtual DataColumn* get_Item(
   String* name
);
[JScript]
returnValue = ColumnsCollectionObject.Item(name);
-or-
returnValue = ColumnsCollectionObject(name);

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed Item property whose type is Object and whose index type is String.

Arguments [JScript]

name
The ColumnName of the column to return.

Parameters [Visual Basic, C#, C++]

name
The ColumnName of the column to return.

Property Value

The DataColumn in the collection with the specified ColumnName.

Exceptions

Exception Type Condition
IndexOutOfRange(System.String) The collection doesn't have a column with this name.

Remarks

Item is case-sensitive when searching for column names. Therefore, if two columns exist, such as "Fname" and "fname," Item property (ColumnsCollection indexer)will find the specific column you name.

Example [Visual Basic]

The following example uses the Item property (ColumnsCollection indexer) to print the DataType value of a DataColumn object specified by index.

[Visual Basic]

Dim cols As DataColumns
' Get the ColumnsCollection from a DataTable in a DataSet.
cols = DataSet1.Tables("Orders").Columns
' Print the DataType of the column named "id."
Console.WriteLine(cols("id").DataType.ToString)

See Also

ColumnsCollection Class | ColumnsCollection Members | System.Data Namespace | ColumnsCollection.Item Overload List | ColumnName | Contains | DataColumn