System.Data.Common Namespace DataColumnMappingCollection Class
Checks whether a given DataColumnMapping object exists in the collection.
[ VB ]
NotOverridable Overloads Public Function Contains ( _
ByVal columnMapping As Object _
) As Boolean Implements IList.Contains
[ C# ]
public bool Contains (
object columnMapping
);
[ C++ ]
public: __sealed bool Contains (
Object* columnMapping
);
[ JScript ]
public function Contains (
columnMapping : Object
) : Boolean
- columnMapping
- A DataColumnMapping object to find.
This method returns only a boolean value: true if the collection contains a specified DataColumnMapping object; otherwise, false.
IList.Contains
Use the Contains method to confirm the existence of a column mapping object before performing further operations on the object.
The following example first uses the Contains method to determine if a particular column mapping exists in the collection. If found, the column mapping is removed with the Remove method.
private void RemoveColumnMapping ( DataTableMapping myTableMap, object myFieldMap ) {
// get the DataColumnMappingCollection of a DataTableMapping
DataColumnMappingCollection myFieldsMaps = myTableMap.ColumnMappings;
if ( myFieldsMaps.Contains ( myFieldMap ) {
myFieldsMaps.Remove ( myFieldMap );
}
}
Private Sub RemoveColumnMapping ( myTableMap As DataTableMapping, myFieldMap As Object )
' get the DataColumnMappingCollection of a DataTableMapping
Dim myFieldsMaps As DataColumnMappingCollection = myTableMap.ColumnMappings
If myFieldsMaps.Contains ( myFieldMap ) Then
myFieldsMaps.Remove ( myFieldMap )
End If
End Sub |
|
C# |
VB |
DataColumnMappingCollection Members DataColumnMappingCollection.Contains Overload List