SectionInformation.IsLocked Egenskap

Definition

Hämtar ett värde som anger om det associerade konfigurationsavsnittet är låst.

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

Egenskapsvärde

trueom avsnittet är låst; annars . false

Exempel

Exemplen i det här avsnittet visar hur du hämtar IsLocked egenskapsvärdet när du har åtkomst till den relaterade avsnittsinformationen i konfigurationsfilen.

I följande exempel hämtas objektet SectionInformation .

// 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

I följande exempel hämtas IsLocked värdet.

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

Kommentarer

Egenskapen IsLocked returnerar true när det relaterade avsnittet är låst av AllowOverride egenskapen eller AllowDefinition . Ett avsnitt är låst om det inte kan åsidosättas eller definieras i den aktuella konfigurationsfilen.

Gäller för