ConfigurationElement.LockItem プロパティ
アセンブリ: System.Configuration (system.configuration.dll 内)

Dim instance As ConfigurationElement Dim value As Boolean value = instance.LockItem instance.LockItem = value
/** @property */ public boolean get_LockItem () /** @property */ public void set_LockItem (boolean value)
要素がロックされている場合は true。それ以外の場合は false。既定値は false です。


' 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()); } }

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に収録されているすべての辞書からConfigurationElement.LockItem プロパティを検索する場合は、下記のリンクをクリックしてください。

- ConfigurationElement.LockItem プロパティのページへのリンク