Freigeben über


SectionInformation.GetParentSection Methode

Definition

Ruft den Konfigurationsabschnitt ab, der den konfigurationsabschnitt enthält, der diesem Objekt zugeordnet ist.

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

Gibt zurück

Der Konfigurationsabschnitt, der das ConfigurationSection diesem SectionInformation Objekt zugeordnete Enthält.

Ausnahmen

Die Methode wird aus einem übergeordneten Abschnitt aufgerufen.

Beispiele

Das folgende Beispiel zeigt, wie die GetParentSection Methode verwendet wird.

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

Hinweise

Wenn dieses ConfigurationSection Objekt keine übergeordneten Abschnitte enthält, gibt die GetParentSection Methode denselben Wert wie die Name Eigenschaft zurück.

Gilt für: