SectionInformation.AllowOverride Eigenschap

Definitie

Hiermee wordt een waarde opgehaald of ingesteld die aangeeft of de bijbehorende configuratiesectie kan worden overschreven door configuratiebestanden op lager niveau.

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

Waarde van eigenschap

true als de sectie kan worden overschreven; anders, false. De standaardwaarde is false.

Voorbeelden

In de voorbeelden in deze sectie ziet u hoe u de AllowOverride eigenschapswaarde kunt ophalen nadat u de gerelateerde sectiegegevens in het configuratiebestand hebt geopend.

In het volgende voorbeeld wordt het SectionInformation object opgehaald.

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

In het volgende voorbeeld wordt de AllowOverride waarde opgehaald.

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

Van toepassing op