DataColumnCollection.Clear Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Clears the collection of any columns.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

public void Clear()

If the collection is successfully changed by adding or removing columns, the CollectionChanged event occurs.

The following example clears the columns collection.

private void ClearColumnsCollection(DataTable table)
    DataColumnCollection columns;
    // Get the DataColumnCollection from a 
    // DataTable in a DataSet.
    columns = table.Columns;

.NET Framework
Available since 1.1
Return to top