SectionInformation.IsDeclarationRequired Propriedade

Definição

Obtém um valor que indica se a seção de configuração deve ser declarada no arquivo de configuração.Gets a value that indicates whether the configuration section must be declared in the configuration file.

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

Valor da propriedade

Boolean

trueSe o ConfigurationSection objeto associado deve ser declarado no arquivo de configuração; caso contrário, false .true if the associated ConfigurationSection object must be declared in the configuration file; otherwise, false.

Exemplos

Os exemplos nesta seção mostram como obter o valor da IsDeclarationRequired Propriedade depois de acessar as informações da seção relacionada no arquivo de configuração.The examples in this section show how to get the IsDeclarationRequired property value after accessing the related section information in the configuration file.

O exemplo a seguir obtém o SectionInformation objeto.The following example gets the SectionInformation object.

// 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 a seguir obtém o IsDeclarationRequired valor.The following example gets the IsDeclarationRequired value.

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

Aplica-se a

Confira também