Share via


FileBasedConfigurationSource.Add Method

Adds a ConfigurationSection to the configuration and saves the configuration source.

Namespace: Microsoft.Practices.EnterpriseLibrary.Common.Configuration
Assembly: Microsoft.Practices.EnterpriseLibrary.Common (in Microsoft.Practices.EnterpriseLibrary.Common.dll) Version: 6.0.0.0 (6.0.1304.0)

Syntax

public void Add(
    string sectionName,
    ConfigurationSection configurationSection
)
'Declaration
Public Sub Add ( 
    sectionName As String,
    configurationSection As ConfigurationSection
)
public:
virtual void Add(
    String^ sectionName, 
    ConfigurationSection^ configurationSection
) sealed

Parameters

  • sectionName
    Type: System.String
    The name by which the configurationSection should be added.

Implements

IConfigurationSource.Add(String, ConfigurationSection)

Remarks

If a configuration section with the specified name already exists it will be replaced. If a configuration section was retrieved from an instance of FileBasedConfigurationSource, a InvalidOperationException will be thrown.

Exceptions

Exception Condition
System.InvalidOperationException The configuration section was retrieved from an instance of FileBasedConfigurationSource or Microsoft.Practices.EnterpriseLibrary.Common.Configuration and cannot be added to the current source.

See Also

FileBasedConfigurationSource Class

FileBasedConfigurationSource Members

Microsoft.Practices.EnterpriseLibrary.Common.Configuration Namespace