C# Class System.Data.DataTableCollection

Inheritance: InternalDataCollectionBase
显示文件 Open project: dotnet/corefx Class Usage Examples

Private Properties

Property Type Description
ArrayAdd void
AssignName string
BaseAdd void
BaseGroupSwitch void
BaseRemove void
CanRemove bool
Contains bool
Contains bool
DataTableCollection System.Diagnostics
FinishInitCollection void
GetTable DataTable
GetTableSmart DataTable
IndexOf int
InternalIndexOf int
InternalIndexOf int
MakeName string
OnCollectionChanged void
OnCollectionChanging void
RegisterName void
ReplaceFromInference void
UnregisterName void

Public Methods

Method Description
Add ( ) : DataTable

Creates a new table with a default name and adds it to the collection.

Add ( string name ) : DataTable

Creates a table with the given name and adds it to the collection.

Add ( string name, string tableNamespace ) : DataTable
Add ( DataTable table ) : void

Adds the specified table to the collection.

AddRange ( DataTable tables ) : void
CanRemove ( DataTable table ) : bool

Verifies if a given table can be removed from the collection.

Clear ( ) : void

Clears the collection of any tables.

Contains ( string name ) : bool

Checks if a table, specified by name, exists in the collection.

Contains ( string name, string tableNamespace ) : bool
CopyTo ( DataTable array, int index ) : void
IndexOf ( DataTable table ) : int

Returns the index of a specified .

IndexOf ( string tableName ) : int

Returns the index of the table with the given name (case insensitive), or -1 if the table doesn't exist in the collection.

IndexOf ( string tableName, string tableNamespace ) : int
Remove ( DataTable table ) : void

Removes the specified table from the collection.

Remove ( string name ) : void

Removes the table with a specified name from the collection.

Remove ( string name, string tableNamespace ) : void
RemoveAt ( int index ) : void

Removes the table at the given index from the collection

this ( int index ) : DataTable

Gets the table specified by its index.

this ( string name ) : DataTable

Gets the table in the collection with the given name (not case-sensitive).

this ( string name, string tableNamespace ) : DataTable

Private Methods

Method Description
ArrayAdd ( DataTable table ) : void
AssignName ( ) : string

Creates a new default name.

BaseAdd ( DataTable table ) : void

Does verification on the table and it's name, and points the table at the dataSet that owns this collection. An ArgumentNullException is thrown if this table is null. An ArgumentException is thrown if this table already belongs to this collection, belongs to another collection. A DuplicateNameException is thrown if this collection already has a table with the same name (case insensitive).

BaseGroupSwitch ( DataTable oldArray, int oldLength, DataTable newArray, int newLength ) : void

BaseGroupSwitch will intelligently remove and add tables from the collection.

BaseRemove ( DataTable table ) : void

Does verification on the table and it's name, and clears the table's dataSet pointer. An ArgumentNullException is thrown if this table is null. An ArgumentException is thrown if this table doesn't belong to this collection or if this table is part of a relationship.

CanRemove ( DataTable table, bool fThrowException ) : bool
Contains ( string name, bool caseSensitive ) : bool
Contains ( string name, string tableNamespace, bool checkProperty, bool caseSensitive ) : bool
DataTableCollection ( DataSet dataSet ) : System.Diagnostics

DataTableCollection constructor. Used only by DataSet.

FinishInitCollection ( ) : void
GetTable ( string name, string ns ) : DataTable
GetTableSmart ( string name, string ns ) : DataTable
IndexOf ( string tableName, string tableNamespace, bool chekforNull ) : int
InternalIndexOf ( string tableName ) : int
InternalIndexOf ( string tableName, string tableNamespace ) : int
MakeName ( int index ) : string

Makes a default name with the given index. e.g. Table1, Table2, ... Tablei

OnCollectionChanged ( CollectionChangeEventArgs ccevent ) : void

Raises the event.

OnCollectionChanging ( CollectionChangeEventArgs ccevent ) : void
RegisterName ( string name, string tbNamespace ) : void

Registers this name as being used in the collection. Will throw an ArgumentException if the name is already being used. Called by Add, All property, and Table.TableName property. if the name is equivalent to the next default name to hand out, we increment our defaultNameIndex.

ReplaceFromInference ( List tableList ) : void
UnregisterName ( string name ) : void

Unregisters this name as no longer being used in the collection. Called by Remove, All property, and Table.TableName property. If the name is equivalent to the last proposed default name, we walk backwards to find the next proper default name to use.

Method Details

Add() public method

Creates a new table with a default name and adds it to the collection.
public Add ( ) : DataTable
return DataTable

Add() public method

Creates a table with the given name and adds it to the collection.
public Add ( string name ) : DataTable
name string
return DataTable

Add() public method

public Add ( string name, string tableNamespace ) : DataTable
name string
tableNamespace string
return DataTable

Add() public method

Adds the specified table to the collection.
public Add ( DataTable table ) : void
table DataTable
return void

AddRange() public method

public AddRange ( DataTable tables ) : void
tables DataTable
return void

CanRemove() public method

Verifies if a given table can be removed from the collection.
public CanRemove ( DataTable table ) : bool
table DataTable
return bool

Clear() public method

Clears the collection of any tables.
public Clear ( ) : void
return void

Contains() public method

Checks if a table, specified by name, exists in the collection.
public Contains ( string name ) : bool
name string
return bool

Contains() public method

public Contains ( string name, string tableNamespace ) : bool
name string
tableNamespace string
return bool

CopyTo() public method

public CopyTo ( DataTable array, int index ) : void
array DataTable
index int
return void

IndexOf() public method

Returns the index of a specified .
public IndexOf ( DataTable table ) : int
table DataTable
return int

IndexOf() public method

Returns the index of the table with the given name (case insensitive), or -1 if the table doesn't exist in the collection.
public IndexOf ( string tableName ) : int
tableName string
return int

IndexOf() public method

public IndexOf ( string tableName, string tableNamespace ) : int
tableName string
tableNamespace string
return int

Remove() public method

Removes the specified table from the collection.
public Remove ( DataTable table ) : void
table DataTable
return void

Remove() public method

Removes the table with a specified name from the collection.
public Remove ( string name ) : void
name string
return void

Remove() public method

public Remove ( string name, string tableNamespace ) : void
name string
tableNamespace string
return void

RemoveAt() public method

Removes the table at the given index from the collection
public RemoveAt ( int index ) : void
index int
return void

this() public method

Gets the table specified by its index.
public this ( int index ) : DataTable
index int
return DataTable

this() public method

Gets the table in the collection with the given name (not case-sensitive).
public this ( string name ) : DataTable
name string
return DataTable

this() public method

public this ( string name, string tableNamespace ) : DataTable
name string
tableNamespace string
return DataTable