Configuration.SaveAs Method (String, ConfigurationSaveMode, Boolean)

 

Writes the configuration settings contained within this Configuration object to the specified XML configuration file.

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

member SaveAs : 
        filename:string *
        saveMode:ConfigurationSaveMode *
        forceSaveAll:bool -> unit

Parameters

filename
Type: System.String

The path and file name to save the configuration file to.

saveMode
Type: System.Configuration.ConfigurationSaveMode

A ConfigurationSaveMode value that determines which property values to save.

forceSaveAll
Type: System.Boolean

true to save even if the configuration was not modified; otherwise, false.

Exception Condition
ArgumentException

filename is null or an empty string ("").

The SaveAs method persists configuration settings in the Configuration object to a new file based on the saveMode and forceSaveAll parameters.

If a configuration file does not exist at the physical location represented by the FilePath property, a new configuration file will be created to contain any settings that are different from the inherited configuration.

If the configuration file has changed since this Configuration object was created, a run-time error occurs.

The following code example demonstrates how to use the SaveAs method.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: