asp.net.ph

DataTableMappingCollection.Contains Method ( Object )

System.Data.Common Namespace   DataTableMappingCollection Class


Checks whether a given DataTableMapping object exists in the collection.

[ VB ]
NotOverridable Overloads Public Function Contains ( _
   ByVal tableMapping As Object _
) As Boolean Implements IList.Contains

[ C# ]
public bool Contains (
   object tableMapping
);

[ C++ ]
public: __sealed bool Contains (
   Object* tableMapping
);

[ JScript ]
public function Contains (
   tableMapping : Object
) : Boolean

Parameters

tableMapping
A DataTableMapping object to find.

Return Value

This method returns only a boolean value: true if the collection contains a specified DataTableMapping object; otherwise, false.

Implements

IList.Contains

Exceptions


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

Remarks

Use the Contains method to confirm the existence of a table mapping object before performing further operations on the object.

Example

The following example first uses the Contains method to determine if a particular table mapping exists in the collection. If found, the table mapping is removed with the Remove method.

private void RemoveTableMapping ( DataAdapter myAdapter, object myTable ) {
   // get the table mappings collection
   DataTableMappingCollection myTables = myAdapter.TableMappings;
   if ( myTables.Contains ( myTable ) {
      myTables.Remove ( myTable );
   }
}
  C# VB

See Also

DataTableMappingCollection Members   DataTableMappingCollection.Contains Overload List 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