ConfigurationManager.RefreshSection メソッド
アセンブリ: System.Configuration (system.configuration.dll 内)



RefreshSection メソッドを使用して、アプリケーション設定の構成セクションを更新する方法を次のコード例に示します。
' Set appSettings. Shared Sub SetAppSettings(refresh As Boolean) ' Get the machine.config file. Dim config As System.Configuration.Configuration = _ ConfigurationManager.OpenExeConfiguration( _ ConfigurationUserLevel.None) Dim appStgCnt As Integer = ConfigurationManager.AppSettings.Count Dim asName As String = "AppSetting" + appStgCnt.ToString() config.AppSettings.Settings.Add(asName, _ DateTime.Now.ToLongDateString() + " " + _ DateTime.Now.ToLongTimeString()) ' Save the configuration file. config.Save(ConfigurationSaveMode.Modified) ' Refresh the appSettings section so the secction ' is read from the disk and not from the cache when ' requested, next time. If refresh Then ConfigurationManager.RefreshSection("AppSettings") End If GetAppSettings() End Sub 'SetAppSettings
// Set appSettings. static void SetAppSettings(bool refresh) { // Get the machine.config file. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); int appStgCnt = ConfigurationManager.AppSettings.Count; string asName = "AppSetting" + appStgCnt.ToString(); config.AppSettings.Settings.Add(asName, DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString()); // Save the configuration file. config.Save(ConfigurationSaveMode.Modified); // Refresh the appSettings section so the secction // is read from the disk and not from the cache when // requested, next time. if (refresh) ConfigurationManager.RefreshSection("AppSettings"); GetAppSettings(); }

Windows 98, Windows 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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からConfigurationManager.RefreshSection メソッドを検索する場合は、下記のリンクをクリックしてください。

- ConfigurationManager.RefreshSection メソッドのページへのリンク