DataTableCollection Class
Represents the collection of tables for the DataSet.
Assembly: System.Data (in System.Data.dll)
The DataTableCollection type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | Count | Gets the total number of elements in a collection. (Inherited from InternalDataCollectionBase.) |
![]() ![]() | IsReadOnly | Gets a value that indicates whether the InternalDataCollectionBase is read-only. (Inherited from InternalDataCollectionBase.) |
![]() ![]() | IsSynchronized | Gets a value that indicates whether the InternalDataCollectionBase is synchonized. (Inherited from InternalDataCollectionBase.) |
![]() ![]() | Item[Int32] | Gets the DataTable object at the specified index. |
![]() ![]() | Item[String] | Gets the DataTable object with the specified name. |
![]() ![]() | Item[String, String] | Gets the DataTable object with the specified name in the specified namespace. |
![]() ![]() | List | Gets the items of the collection as a list. (Inherited from InternalDataCollectionBase.) |
![]() ![]() | SyncRoot | Gets an object that can be used to synchronize the collection. (Inherited from InternalDataCollectionBase.) |
| Name | Description | |
|---|---|---|
![]() ![]() | Add() | Creates a new DataTable object by using a default name and adds it to the collection. |
![]() ![]() | Add(DataTable) | Adds the specified DataTable to the collection. |
![]() ![]() | Add(String) | Creates a DataTable object by using the specified name and adds it to the collection. |
![]() ![]() | Add(String, String) | Creates a DataTable object by using the specified name and adds it to the collection. |
![]() ![]() | AddRange | Copies the elements of the specified DataTable array to the end of the collection. |
![]() ![]() | CanRemove | Verifies whether the specified DataTable object can be removed from the collection. |
![]() ![]() | Clear | Clears the collection of all DataTable objects. |
![]() ![]() | Contains(String) | Gets a value that indicates whether a DataTable object with the specified name exists in the collection. |
![]() ![]() | Contains(String, String) | Gets a value that indicates whether a DataTable object with the specified name and table namespace exists in the collection. |
![]() ![]() | CopyTo(Array, Int32) | Copies all the elements of the current InternalDataCollectionBase to a one-dimensional Array, starting at the specified InternalDataCollectionBase index. (Inherited from InternalDataCollectionBase.) |
![]() ![]() | CopyTo(array<DataTable>, Int32) | Copies all the elements of the current DataTableCollection to a one-dimensional Array, starting at the specified destination array index. |
![]() ![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() ![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() | GetEnumerator | Gets an IEnumerator for the collection. (Inherited from InternalDataCollectionBase.) |
![]() ![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() ![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | IndexOf(DataTable) | Gets the index of the specified DataTable object. |
![]() ![]() | IndexOf(String) | Gets the index in the collection of the DataTable object with the specified name. |
![]() ![]() | IndexOf(String, String) | Gets the index in the collection of the specified DataTable object. |
![]() ![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() | Remove(DataTable) | Removes the specified DataTable object from the collection. |
![]() ![]() | Remove(String) | Removes the DataTable object with the specified name from the collection. |
![]() ![]() | Remove(String, String) | Removes the DataTable object with the specified name from the collection. |
![]() ![]() | RemoveAt | Removes the DataTable object at the specified index from the collection. |
![]() ![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | CollectionChanged | Occurs after the DataTableCollection is changed because of DataTable objects being added or removed. |
![]() ![]() | CollectionChanging | Occurs while the DataTableCollection is changing because of DataTable objects being added or removed. |
The DataTableCollection contains all the DataTable objects for a particular DataSet. To access the DataTableCollection of a DataSet, use the Tables property.
The DataTableCollection uses methods such as Add, Clear, and Remove to manage the items in the collection.
Use the Contains method to determine whether a particular table (specified by either index or name) is in the collection.
To navigate from one table to another, use the ChildRelations or ParentRelations property of the DataTable to access its collection of DataRelation objects. You can also use the Relations property to navigate through the parent/child relationships of the DataTables in a particular DataSet collection.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
