DataTableCollection.Clear 方法   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
清除所有 DataTable 对象的集合。
public:
 void Clear();public void Clear ();member this.Clear : unit -> unitPublic Sub Clear ()示例
以下示例获取 DataTableCollection 的 DataSet,然后清除所有表的 集合。
private void ClearTables()
{
    // Get the DataSet of a DataGrid control.
    DataSet dataSet = (DataSet)DataGrid1.DataSource;
    DataTableCollection tables = dataSet.Tables;
    // Clear the collection.
    tables.Clear();
}
Private Sub ClearTables()
   ' Get the DataSet of a DataGrid control.
   Dim dataSet As DataSet = CType(DataGrid1.DataSource, DataSet)
   Dim tables As DataTableCollection = dataSet.Tables
   ' Clear the collection.
   tables.Clear
End Sub
注解
若要从集合中删除特定 DataTable ,请使用 Remove 方法。