System.Data.Common Namespace DataTableMappingCollection Class
Returns the index of a specified DataTableMapping object.
[ VB ]
NotOverridable Overloads Public Function IndexOf ( _
ByVal table As Object _
) As Integer Implements IList.IndexOf
[ C# ]
public int IndexOf (
object table
);
[ C++ ]
public: __sealed int IndexOf (
Object* table
);
[ JScript ]
public function IndexOf (
table : Object
) : int;
- table
- The DataTableMapping to find.
The index of the DataTableMapping if it is in the collection; otherwise, -1.
IList.IndexOf
Use the IndexOf method to determine the index of a given table mapping object.
Before calling IndexOf, you can test for the existence of a table mapping by using the Contains method.
The following example returns the index of each table in a DataTableMappingCollection.
private void GetIndexes ( DataAdapter myAdapter ) {
DataTableMappingCollection myTables = myAdapter.TableMappings;
// get the index of each table in the collection.
foreach ( DataTableMapping myTable in myTables ) {
Response.Write ( myTables.IndexOf ( myTable ) );
}
}
Private Sub GetIndexes ( ByVal myAdapter As DataAdapter )
Dim myTables As DataTableMappingCollection = myAdapter.TableMappings
Dim myTable As DataTableMapping
' get the index of each table in the collection.
For Each myTable In myTables
Response.Write ( myTables.IndexOf ( myTable ) )
Next
End Sub |
|
C# |
VB |
DataTableMappingCollection Members DataTableMappingCollection.IndexOf Overload List Contains