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
- tableMapping
- A DataTableMapping object to find.
This method returns only a boolean value: true if the collection contains a specified DataTableMapping object; otherwise, false.
IList.Contains
Use the Contains method to confirm the existence of a table mapping object before performing further operations on the object.
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 );
}
}
Private Sub RemoveTableMapping ( myAdapter As DataAdapter, myTable As Object )
' get the table mappings collection
Dim myTables As DataTableMappingCollection = myAdapter.TableMappings
If myTables.Contains ( myTable ) Then
myTables.Remove ( myTable )
End If
End Sub |
|
C# |
VB |
DataTableMappingCollection Members DataTableMappingCollection.Contains Overload List