SectionInformation Class

 

Contains metadata about an individual section within the configuration hierarchy. This class cannot be inherited.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

System.Object
  System.Configuration.SectionInformation

public sealed class SectionInformation

NameDescription
System_CAPS_pubpropertyAllowDefinition

Gets or sets a value that indicates where in the configuration file hierarchy the associated configuration section can be defined.

System_CAPS_pubpropertyAllowExeDefinition

Gets or sets a value that indicates where in the configuration file hierarchy the associated configuration section can be declared.

System_CAPS_pubpropertyAllowLocation

Gets or sets a value that indicates whether the configuration section allows the location attribute.

System_CAPS_pubpropertyAllowOverride

Gets or sets a value that indicates whether the associated configuration section can be overridden by lower-level configuration files.

System_CAPS_pubpropertyConfigSource

Gets or sets the name of the include file in which the associated configuration section is defined, if such a file exists.

System_CAPS_pubpropertyForceSave

Gets or sets a value that indicates whether the associated configuration section will be saved even if it has not been modified.

System_CAPS_pubpropertyInheritInChildApplications

Gets or sets a value that indicates whether the settings that are specified in the associated configuration section are inherited by applications that reside in a subdirectory of the relevant application.

System_CAPS_pubpropertyIsDeclarationRequired

Gets a value that indicates whether the configuration section must be declared in the configuration file.

System_CAPS_pubpropertyIsDeclared

Gets a value that indicates whether the associated configuration section is declared in the configuration file.

System_CAPS_pubpropertyIsLocked

Gets a value that indicates whether the associated configuration section is locked.

System_CAPS_pubpropertyIsProtected

Gets a value that indicates whether the associated configuration section is protected.

System_CAPS_pubpropertyName

Gets the name of the associated configuration section.

System_CAPS_pubpropertyOverrideMode

Gets or sets the OverrideMode enumeration value that specifies whether the associated configuration section can be overridden by child configuration files.

System_CAPS_pubpropertyOverrideModeDefault

Gets or sets a value that specifies the default override behavior of a configuration section by child configuration files.

System_CAPS_pubpropertyOverrideModeEffective

Gets the override behavior of a configuration section that is in turn based on whether child configuration files can lock the configuration section.

System_CAPS_pubpropertyProtectionProvider

Gets the protected configuration provider for the associated configuration section.

System_CAPS_pubpropertyRequirePermission

Gets a value that indicates whether the associated configuration section requires access permissions.

System_CAPS_pubpropertyRestartOnExternalChanges

Gets or sets a value that specifies whether a change in an external configuration include file requires an application restart.

System_CAPS_pubpropertySectionName

Gets the name of the associated configuration section.

System_CAPS_pubpropertyType

Gets or sets the section class name.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodForceDeclaration()

Forces the associated configuration section to appear in the configuration file.

System_CAPS_pubmethodForceDeclaration(Boolean)

Forces the associated configuration section to appear in the configuration file, or removes an existing section from the configuration file.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetParentSection()

Gets the configuration section that contains the configuration section associated with this object.

System_CAPS_pubmethodGetRawXml()

This API supports the product infrastructure and is not intended to be used directly from your code. Returns an XML node object that represents the associated configuration-section object.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodProtectSection(String)

Marks a configuration section for protection.

System_CAPS_pubmethodRevertToParent()

Causes the associated configuration section to inherit all its values from the parent section.

System_CAPS_pubmethodSetRawXml(String)

This API supports the product infrastructure and is not intended to be used directly from your code. Sets the object to an XML representation of the associated configuration section within the configuration file.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodUnprotectSection()

Removes the protected configuration encryption from the associated configuration section.

The SectionInformation object contains the metadata about an individual section within the configuration hierarchy. This object can be used in order to validate and change the properties of an individual section.

The following example shows how to get the SectionInformation metadata that is associated with a ConfigurationSection object.

static public SectionInformation 
    GetSectionInformation()
{

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

    return sInfo;

}

The following example is an excerpt of the configuration file that is used by the previous example.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="MyUrls" type="Samples.AspNet.UrlsSection,
      ConfigurationElement, Version=1.0.0.0, Culture=neutral,
      PublicKeyToken=null" allowDefinition="Everywhere"
      allowExeDefinition="MachineToApplication"
      restartOnExternalChanges="true" />
  </configSections>
  <MyUrls name="MyFavorites">
    <simple name="Contoso" url="http://www.contoso.com" port="8080" />
    <urls>
      <clear />
      <add name="Microsoft" url="http://www.microsoft.com" port="0" />
    </urls>
  </MyUrls>
</configuration>

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: