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 (String)

Checks whether the collection contains a column with the specified name.

[Visual Basic]
Overloads Public Function Contains( _
   ByVal name As String _
) As Boolean
[C#]
public bool Contains(
   string name
);
[C++]
public: bool Contains(
   String* name
);
[JScript]
public function Contains(
   name : String
) : Boolean;

Parameters

name
The ColumnName of the column.

Return Value

true if a column exists with this name; 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("Total") And cols.CanRemove(cols("Total")) Then
   cols.Remove "Total"
End If

See Also

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