SectionInformation.IsDeclared 속성

정의

연결된 구성 섹션이 구성 파일에 선언되어 있는지 여부를 나타내는 값을 가져옵니다.

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

속성 값

ConfigurationSection이 구성 파일에 선언되어 있으면 true이고, 그렇지 않으면 false입니다. 기본값은 true입니다.

예제

이 섹션의 예제에서는 구성 파일의 IsDeclared 관련 섹션 정보에 액세스한 후 속성 값을 가져오는 방법을 보여 줍니다.

다음 예제에서는 개체를 SectionInformation 가져옵니다.

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

다음 예제에서는 값을 가져옵니다 IsDeclared .

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

적용 대상