SectionInformation.ForceSave プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SectionInformation.ForceSave プロパティの意味・解説 

SectionInformation.ForceSave プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

関連付けられている構成セクション変更されていない場合保存されるかどうかを示す値を取得または設定します

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

Dim instance As SectionInformation
Dim value As Boolean

value = instance.ForceSave

instance.ForceSave = value
public bool ForceSave { get;
 set; }
/** @property */
public boolean get_ForceSave ()

/** @property */
public void set_ForceSave (boolean value)

プロパティ
関連付けられている ConfigurationSection オブジェクト変更されていない場合保存される場合trueそれ以外場合false既定値false です。

使用例使用例

ConfigurationSection オブジェクトForceSave プロパティ使用する方法の例を次に示します

' Create a section whose name is 
' MyUrls that contains a nested collection as 
' defined by the UrlsSection class.
Shared Sub CreateSection() 
    Dim sectionName As String
 = "MyUrls"
    
    Try
        
        ' Get the current configuration file.
        Dim config _
        As System.Configuration.Configuration = _
        ConfigurationManager.OpenExeConfiguration( _
        ConfigurationUserLevel.None)
        
        Dim urlsSection As UrlsSection
        
        ' Create the section whose name
        ' attribute isMyUrls in 
        ' <configSections>.
        ' Also, create the related target section 
        ' MyUrls in <configuration>.
        If config.Sections(sectionName) Is
 Nothing Then
            urlsSection = New UrlsSection()
            
            ' Change the default values of 
            ' the simple element.
            urlsSection.Simple.Name = "Contoso"
            urlsSection.Simple.Url = "http://www.contoso.com"
            urlsSection.Simple.Port = 8080
            
            config.Sections.Add(sectionName, urlsSection)
            urlsSection.SectionInformation.ForceSave = True
            config.Save(ConfigurationSaveMode.Full)
        End If
    Catch e As ConfigurationErrorsException
        Console.WriteLine("[CreateSection: {0}]",
 e.ToString())
    End Try

End Sub 'CreateSection

// Create a section whose name is 
// MyUrls that contains a nested collection as 
// defined by the UrlsSection class.
static void CreateSection()
{
    string sectionName = "MyUrls";

    try
    {

        // Get the current configuration file.
        System.Configuration.Configuration config =
                ConfigurationManager.OpenExeConfiguration(
                ConfigurationUserLevel.None);

        UrlsSection urlsSection;

        // Create the section whose name attribute 
        // is MyUrls in <configSections>.
        // Also, create the related target section 
        // MyUrls in <configuration>.
        if (config.Sections[sectionName] == null)
        {
            urlsSection = new UrlsSection();

            // Change the default values of 
            // the simple element.
            urlsSection.Simple.Name = "Contoso";
            urlsSection.Simple.Url =  "http://www.contoso.com";
            urlsSection.Simple.Port = 8080;

            config.Sections.Add(sectionName, urlsSection);
            urlsSection.SectionInformation.ForceSave = true;
            config.Save(ConfigurationSaveMode.Full);
        }
    }
    catch (ConfigurationErrorsException e)
    {
        Console.WriteLine("[CreateSection: {0}]",
            e.ToString());
    }


}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「SectionInformation.ForceSave プロパティ」の関連用語

SectionInformation.ForceSave プロパティのお隣キーワード
検索ランキング

   

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



SectionInformation.ForceSave プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS