SectionInformation.GetParentSection Method

Definition

Ottiene la sezione di configurazione che contiene la sezione di configurazione associata a questo oggetto.Gets the configuration section that contains the configuration section associated with this object.

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

Returns

ConfigurationSection

Sezione di configurazione contenente l'oggetto ConfigurationSection associato all'oggetto SectionInformation.The configuration section that contains the ConfigurationSection that is associated with this SectionInformation object.

Exceptions

Il metodo viene richiamato da una sezione padre.The method is invoked from a parent section.

Examples

Nell'esempio seguente viene illustrato come utilizzare il metodo GetParentSection.The following example shows how to use the GetParentSection method.

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

Remarks

Se questo ConfigurationSection oggetto non ha sezioni padre, il metodo GetParentSection restituisce lo stesso valore della proprietà Name.If this ConfigurationSection object has no parent sections, the GetParentSection method returns the same value as the Name property.

Applies to