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