ConfigurationManager.RefreshSection Method

Refreshes the named section so the next time that it is retrieved it will be re-read from disk.

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

Public Shared Sub RefreshSection ( _
	sectionName As String _
Dim sectionName As String

public static void RefreshSection (
	String sectionName
public static function RefreshSection (
	sectionName : String
Not applicable.



The configuration section name or the configuration path and section name of the section to refresh.

This method invalidates the cache for the specified configuration section without affecting other sections.

The following code example shows how to use the RefreshSection method to refresh the application settings configuration section.

' Show how to use OpenExeConfiguration(ConfigurationUserLevel) 
' and RefreshSection. 
Shared Sub UpdateAppSettings() 
    ' Get the configuration file.
    Dim config As System.Configuration.Configuration = _
    ' Add an entry to appSettings.
    Dim appStgCnt As Integer = _
    Dim newKey As String = "NewKey" + appStgCnt.ToString()
    Dim newValue As String = DateTime.Now.ToLongDateString() + " " + _
    config.AppSettings.Settings.Add(newKey, newValue)
    ' Save the configuration file.
    ' Force a reload of the changed section.

End Sub 'UpdateAppSettings

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0