SectionInformation.IsDeclared Propiedad

Definición

Obtiene un valor que indica si la sección de configuración asociada se declara en el archivo de configuración.

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

Valor de propiedad

Es true si este objeto ConfigurationSection se declara en el archivo de configuración; de lo contrario, es false. De manera predeterminada, es true.

Ejemplos

Los ejemplos de esta sección muestran cómo obtener el valor de propiedad IsDeclared después de tener acceso a la información de sección relacionada en el archivo de configuración.

En el ejemplo siguiente se obtiene el SectionInformation objeto .

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

En el ejemplo siguiente se obtiene el IsDeclared valor .

bool declared =
    sInfo.IsDeclared;
Console.WriteLine("Section declared?: {0}",
    declared.ToString());
Dim declared As Boolean = _
sInfo.IsDeclared
Console.WriteLine("Section declared?: {0}", _
declared.ToString())

Se aplica a