SectionInformation.IsDeclarationRequired Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Olyan értéket kap, amely jelzi, hogy a konfigurációs szakaszt deklarálni kell-e a konfigurációs fájlban.
public:
property bool IsDeclarationRequired { bool get(); };
public bool IsDeclarationRequired { get; }
member this.IsDeclarationRequired : bool
Public ReadOnly Property IsDeclarationRequired As Boolean
Tulajdonság értéke
trueha a társított ConfigurationSection objektumot deklarálni kell a konfigurációs fájlban; ellenkező esetben. false
Példák
Az ebben a szakaszban szereplő példák bemutatják, hogyan szerezheti be a tulajdonság értékét a IsDeclarationRequired konfigurációs fájl kapcsolódó szakaszadatainak elérése után.
Az alábbi példa lekéri az SectionInformation objektumot.
// 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
Az alábbi példa lekéri az IsDeclarationRequired értéket.
bool declRequired =
sInfo.IsDeclarationRequired;
Console.WriteLine("Declaration required?: {0}",
declRequired.ToString());
Dim declRequired As Boolean = _
sInfo.IsDeclarationRequired
Console.WriteLine("Declaration required?: {0}", _
declRequired.ToString())