共用方式為


SectionInformation.AllowOverride 屬性

定義

取得或設定值,指出較低層級的組態檔是否可以覆寫關聯的組態區段。

public:
 property bool AllowOverride { bool get(); void set(bool value); };
public bool AllowOverride { get; set; }
member this.AllowOverride : bool with get, set
Public Property AllowOverride As Boolean

屬性值

如果可以覆寫此區段,則為 true,否則為 false。 預設為 false

範例

本節中的範例示範如何在存取組態檔中相關的區段信息之後取得 AllowOverride 屬性值。

下列範例會取得 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

下列範例會取得 AllowOverride 值。

bool allowOverride =
    sInfo.AllowOverride;
Console.WriteLine("Allow override: {0}",
               allowOverride.ToString());
Dim allowOverride As Boolean = _
sInfo.AllowOverride
Console.WriteLine("Allow override: {0}", _
allowOverride.ToString())

適用於