Removes all the System.Web.Configuration.ClientTarget objects from the collection.
The result of updating the configuration file after calling the ClientTargetCollection.Clear method is dependent upon the System.Configuration.ConfigurationSaveMode value chosen. To update the configuration file you use one of these two methods: System.Configuration.Configuration.Save or System.Configuration.Configuration.Save(System.Configuration.ConfigurationSaveMode).
Calling System.Configuration.Configuration.Save is equivalent to calling System.Configuration.Configuration.Save(System.Configuration.ConfigurationSaveMode) when the System.Configuration.ConfigurationSaveMode value is modified.
If you use the System.Configuration.Configuration.Save(System.Configuration.ConfigurationSaveMode) method, the following conditions apply:
If you pass the System.Configuration.ConfigurationSaveMode.Full or System.Configuration.ConfigurationSaveMode.Modified parameter value, then a clear element is inserted into the clientTarget section of the configuration file at the current hierarchy level.
If you pass the System.Configuration.ConfigurationSaveMode.Minimal parameter value, a series of remove elements are added to the clientTarget section of the configuration file at the current hierarchy level. This removes all references to the add elements defined in the parent configuration files at higher levels in the hierarchy. With the System.Configuration.ConfigurationSaveMode.Minimal enumeration value, one additional property on the collection affects what gets serialized to the configuration file. The property is System.Configuration.ConfigurationElementCollection.EmitClear and is false by default. One of the following conditions applies:
The ClientTargetCollection.Clear method actually deletes the add elements defined in the clientTarget section of the configuration file at the current hierarchy level. It also removes all references to the add elements defined in the parent configuration files at higher levels in the hierarchy.
The add elements are not deleted from the clientTarget section of the parent configuration files.