SectionInformation.IsDeclared Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt een waarde opgehaald die aangeeft of de bijbehorende configuratiesectie is gedeclareerd in het configuratiebestand.
public:
property bool IsDeclared { bool get(); };
public bool IsDeclared { get; }
member this.IsDeclared : bool
Public ReadOnly Property IsDeclared As Boolean
Waarde van eigenschap
trueals dit ConfigurationSection is gedeclareerd in het configuratiebestand; anders. false De standaardwaarde is true.
Voorbeelden
In de voorbeelden in deze sectie ziet u hoe u de IsDeclared 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 IsDeclared waarde opgehaald.
bool declared =
sInfo.IsDeclared;
Console.WriteLine("Section declared?: {0}",
declared.ToString());
Dim declared As Boolean = _
sInfo.IsDeclared
Console.WriteLine("Section declared?: {0}", _
declared.ToString())