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

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

ConfigurationElement.LockItem プロパティ

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

要素ロックされているかどうかを示す値を取得または設定します

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

Dim instance As ConfigurationElement
Dim value As Boolean

value = instance.LockItem

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

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

プロパティ
要素ロックされている場合trueそれ以外場合false既定値false です。

解説解説
使用例使用例

LockItem使用する方法の例を次に示します

' Show how to set LockItem
' It adds a new UrlConfigElement to 
' the collection.
Shared Sub LockItem() 
    Dim name As String =
 "Contoso"
    Dim url As String =
 "http://www.contoso.com/"
    Dim port As Integer
 = 8080
    
    Try
        ' Get the current configuration file.
        Dim config _
        As System.Configuration.Configuration = _
        ConfigurationManager.OpenExeConfiguration( _
        ConfigurationUserLevel.None)

        ' Get the MyUrls section.
        Dim myUrls As UrlsSection = _
        config.Sections("MyUrls")
        
        
        ' Create the new  element.
        Dim newElement _
        As New UrlConfigElement(name, url,
 port)
        
        ' Set its lock.
        newElement.LockItem = True
        
        ' Save the new element to the 
        ' configuration file.
        If Not myUrls.ElementInformation.IsLocked
 Then
            
            myUrls.Urls.Add(newElement)
            
            config.Save(ConfigurationSaveMode.Full)
            
            ' This is used to obsolete the cached 
            ' section and read the updared version 
            ' from the configuration file.
            ConfigurationManager.RefreshSection("MyUrls")
        Else
            Console.WriteLine("Section was locked, could not update.")
        End If
    
    Catch e As ConfigurationErrorsException
        Console.WriteLine("[LockItem: {0}]", _
        e.ToString())
    End Try

End Sub 'LockItem

// Show how to set LockItem
// It adds a new UrlConfigElement to 
// the collection.
static void LockItem()
{
    string name = "Contoso";
    string url = "http://www.contoso.com/";
    int port = 8080;

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

        // Get the MyUrls section.
        UrlsSection myUrls =
           config.Sections["MyUrls"] as UrlsSection;


        // Create the new  element.
        UrlConfigElement newElement =
            new UrlConfigElement(name, url, port);

        // Set its lock.
        newElement.LockItem = true;

        // Save the new element to the 
        // configuration file.
        if (!myUrls.ElementInformation.IsLocked)
        {

            myUrls.Urls.Add(newElement);

            config.Save(ConfigurationSaveMode.Full);

            // This is used to obsolete the cached 
            // section and read the updated 
            // bersion from the configuration file.
            ConfigurationManager.RefreshSection("MyUrls");
        }
        else
            Console.WriteLine(
                "Section was locked, could not update.");

    }
    catch (ConfigurationErrorsException e)
    {
        Console.WriteLine("[LockItem: {0}]",
            e.ToString());
    }

}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConfigurationElement クラス
ConfigurationElement メンバ
System.Configuration 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からConfigurationElement.LockItem プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からConfigurationElement.LockItem プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からConfigurationElement.LockItem プロパティ を検索

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS