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.Contains (Int32)

Checks whether the collection has a column at the specified index.

[Visual Basic]
Overloads Public Function Contains( _
   ByVal index As Integer _
) As Boolean
[C#]
public bool Contains(
   int index
);
[C++]
public: bool Contains(
   int index
);
[JScript]
public function Contains(
   index : int
) : Boolean;

Parameters

index
The index of the column.

Return Value

true if a column exists at this index; otherwise, false.

Remarks

The Contains method can confirm the existence of a column before performing further operations on the column.

Example [Visual Basic]

The following example uses the Contains method and the CanRemove method to determine whether the column can be removed. If so, the column is removed.

[Visual Basic]

Dim cols As ColumnsCollection
' Get the ColumnsCollection from a DataTable in a DataSet.
cols = DataSet1.Tables("Orders").Columns
If cols.Contains(2) And cols.CanRemove(cols(2)) Then
   cols.Remove 2
End If

See Also

ColumnsCollection Class | ColumnsCollection Members | System.Data Namespace | ColumnsCollection.Contains Overload List | CanRemove | IndexOf