SectionInformation.IsDeclarationRequired Eigenschap

Definitie

Hiermee wordt een waarde opgehaald die aangeeft of de configuratiesectie moet worden gedeclareerd in het configuratiebestand.

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

Waarde van eigenschap

true als het bijbehorende ConfigurationSection object moet worden gedeclareerd in het configuratiebestand; falseanders.

Voorbeelden

In de voorbeelden in deze sectie ziet u hoe u de IsDeclarationRequired 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 IsDeclarationRequired waarde opgehaald.

bool declRequired = 
    sInfo.IsDeclarationRequired;
Console.WriteLine("Declaration required?: {0}",
    declRequired.ToString());
Dim declRequired As Boolean = _
sInfo.IsDeclarationRequired
Console.WriteLine("Declaration required?: {0}", _
declRequired.ToString())

Van toepassing op

Zie ook