SectionInformation.GetParentSection 方法

定义

获取配置节,其中包含与此对象关联的配置节。

public:
 System::Configuration::ConfigurationSection ^ GetParentSection();
public System.Configuration.ConfigurationSection GetParentSection ();
member this.GetParentSection : unit -> System.Configuration.ConfigurationSection
Public Function GetParentSection () As ConfigurationSection

返回

配置节,其中包含与此 ConfigurationSection 对象关联的 SectionInformation

例外

该方法是从父节调用。

示例

下面的示例显示如何使用 GetParentSection 方法。

static public void GetParentSection()
{
    SectionInformation sInfo = 
        GetSectionInformation();

    ConfigurationSection parentSection =
        sInfo.GetParentSection();

    Console.WriteLine("Parent section : {0}",
        parentSection.SectionInformation.Name);
}
Public Shared Sub GetParentSection() 

    Dim sInfo As SectionInformation = _
    GetSectionInformation()
    
    Dim parentSection _
    As ConfigurationSection = _
    sInfo.GetParentSection()
    
    Console.WriteLine("Parent section : {0}", _
    parentSection.SectionInformation.Name)

End Sub

注解

如果此 ConfigurationSection 对象没有父部分,该方法 GetParentSection 将返回与 属性相同的值 Name

适用于