SectionInformation.IsLocked Propriedade

Definição

Recebe um valor que indica se a secção de configuração associada está bloqueada.

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

Valor de Propriedade

true se a secção estiver bloqueada; caso contrário, false.

Exemplos

Os exemplos nesta secção mostram como obter o valor da IsLocked propriedade após aceder à informação da secção relacionada no ficheiro de configuração.

O exemplo seguinte obtém o SectionInformation objeto.

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

O exemplo seguinte obtém o IsLocked valor.

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

Observações

A IsLocked propriedade retorna true quando a secção relacionada está bloqueada pela AllowOverride ou pela AllowDefinition propriedade. Uma secção é bloqueada se não puder ser sobreposta ou definida no ficheiro de configuração atual.

Aplica-se a