System.Data.Common Namespace DataColumnMappingCollection Class
Removes the specified DataColumnMapping from the collection.
[ VB ]
NotOverridable Public Sub Remove ( _
ByVal column As Object _
) Implements IList.Remove
[ C# ]
public void Remove (
Object column
);
[ C++ ]
public: __sealed void Remove (
Object* column
);
[ JScript ]
public function Remove (
column : Object
);
- column
- The DataColumnMapping to remove.
IList.Remove
Use this method to remove a given DataColumnMapping object from the ColumnMappings collection of a specified DataTableMapping object.
To remove a DataColumnMapping at a specified index in the collection, use the RemoveAt method. To remove all members of the collection at once, use the Clear method.
This method also resets the ColumnMappings.Count property.
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 Add Clear Contains