System.Data.DataTableCollection.Contains Method

Gets a value that indicates whether a System.Data.DataTable object with the specified name exists in the collection.

Syntax

public bool Contains (string name)

Parameters

name
The name of the System.Data.DataTable to find.

Returns

true if the specified table exists; otherwise false.

Remarks

You specify the name of the System.Data.DataTable object by using the DataTable.TableName property. If you add a System.Data.DataTable to the collection with the DataTableCollection.Add(DataTable) method, passing no arguments, the table is given a default name, based on the order in which the table was added ("Table1", "Table2", and so on).

To get the index of a System.Data.DataTable, use the DataTableCollection.IndexOf(DataTable) method.

Note:

Returns false when two or more tables have the same name but different namespaces. The call does not succeed if there is any ambiguity when matching a table name to exactly one table.

Requirements

Namespace: System.Data
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0