asp.net.ph

DataColumnMappingCollection.IndexOf Method ( DataColumnMapping )

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;

Parameters

column
The DataColumnMapping to find.

Return Value

The index of the DataColumnMapping if it is in the collection; otherwise, -1.

Implements

IList.IndexOf

Exceptions


Exception Type Condition
InvalidCastException The parameter passed is not a DataColumnMapping object.

Remarks

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.

Example

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 ) );
   }
}
  C# VB

See Also

DataColumnMappingCollection Members   DataColumnMappingCollection.IndexOf Overload List   Contains Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph