SectionInformation.IsLocked Свойство

Определение

Возвращает значение, указывающее, заблокирован ли связанный раздел конфигурации.

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

Значение свойства

Значение true, если раздел заблокирован; в противном случае — значение false.

Примеры

В примерах в этом разделе показано, как получить IsLocked значение свойства после получения сведений о связанном разделе в файле конфигурации.

В следующем примере возвращается 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

В следующем примере возвращается IsLocked значение .

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

Комментарии

Свойство IsLocked возвращает, true если связанный раздел заблокирован свойством AllowOverride или AllowDefinition . Раздел блокируется, если его невозможно переопределить или определить в текущем файле конфигурации.

Применяется к