SectionInformation.IsDeclared Propriedade
Definição
Obtém um valor que indica se a seção de configuração associada está declarada no arquivo de configuração.Gets a value that indicates whether the associated configuration section is declared in the configuration file.
public:
property bool IsDeclared { bool get(); };
public bool IsDeclared { get; }
member this.IsDeclared : bool
Public ReadOnly Property IsDeclared As Boolean
Valor da propriedade
trueSe isso ConfigurationSection for declarado no arquivo de configuração; caso contrário, false .true if this ConfigurationSection is declared in the configuration file; otherwise, false. O padrão é true.The default is true.
Exemplos
Os exemplos nesta seção mostram como obter o valor da IsDeclared 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 IsDeclared 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 IsDeclared valor.The following example gets the IsDeclared value.
bool declared =
sInfo.IsDeclared;
Console.WriteLine("Section declared?: {0}",
declared.ToString());
Dim declared As Boolean = _
sInfo.IsDeclared
Console.WriteLine("Section declared?: {0}", _
declared.ToString())