ConfigurationManager.RefreshSection メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ConfigurationManager.RefreshSection メソッドの意味・解説 

ConfigurationManager.RefreshSection メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

前付セクション次回取得するときに、ディスクから再読取りするように、名前付セクション更新します

名前空間: System.Configuration
アセンブリ: System.Configuration (system.configuration.dll 内)
構文構文

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

ConfigurationManager.RefreshSection(sectionName)
public static void RefreshSection
 (
    string sectionName
)
public:
static void RefreshSection (
    String^ sectionName
)
public static void RefreshSection
 (
    String sectionName
)
public static function RefreshSection
 (
    sectionName : String
)

パラメータ

sectionName

更新する構成セクション名、またはセクション構成パスセクション名。

解説解説
使用例使用例

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();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ConfigurationManager.RefreshSection メソッド」の関連用語

ConfigurationManager.RefreshSection メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ConfigurationManager.RefreshSection メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS