Share via


SectionInformation.IsLocked Eigenschaft

Definition

Ruft einen Wert ab, der angibt, ob der zugeordnete Konfigurationsabschnitt gesperrt ist.

public:
 property bool IsLocked { bool get(); };
public bool IsLocked { get; }
member this.IsLocked : bool
Public ReadOnly Property IsLocked As Boolean

Eigenschaftswert

true, wenn der Abschnitt gesperrt ist, andernfalls false.

Beispiele

Die Beispiele in diesem Abschnitt zeigen, wie Sie den IsLocked Eigenschaftswert abrufen, nachdem Sie auf die entsprechenden Abschnittsinformationen in der Konfigurationsdatei zugegriffen haben.

Im folgenden Beispiel wird das SectionInformation -Objekt abgerufen.

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

// Get the section.
UrlsSection section =
    (UrlsSection)config.GetSection("MyUrls");

SectionInformation sInfo =
    section.SectionInformation;
' Get the current configuration file.
Dim config _
As System.Configuration.Configuration = _
ConfigurationManager.OpenExeConfiguration( _
ConfigurationUserLevel.None)

' Get the section.
Dim section As UrlsSection = _
CType(config.GetSection("MyUrls"), UrlsSection)
        
Dim sInfo As SectionInformation = _
section.SectionInformation

Im folgenden Beispiel wird der IsLocked Wert abgerufen.

bool locked =
   sInfo.IsLocked;
Console.WriteLine("Section locked?: {0}",
    locked.ToString());
Dim locked As Boolean = _
sInfo.IsLocked
Console.WriteLine("Section locked?: {0}", _
locked.ToString())

Hinweise

Die IsLocked -Eigenschaft gibt zurück true , wenn der zugehörige Abschnitt durch die AllowOverride -Eigenschaft oder AllowDefinition gesperrt ist. Ein Abschnitt ist gesperrt, wenn er in der aktuellen Konfigurationsdatei nicht überschrieben oder definiert werden kann.

Gilt für: