ConfigurationSectionCollection Class
Represents a collection of related sections within a configuration file.
Assembly: System.Configuration (in System.Configuration.dll)
System.Collections.Specialized::NameObjectCollectionBase
System.Configuration::ConfigurationSectionCollection
| Name | Description | |
|---|---|---|
![]() | Count | Gets the number of sections in this ConfigurationSectionCollection object.(Overrides NameObjectCollectionBase::Count.) |
![]() | Item[Int32] | Gets the specified ConfigurationSection object. |
![]() | Item[String^] | Gets the specified ConfigurationSection object. |
![]() | Keys | Gets the keys to all ConfigurationSection objects contained in this ConfigurationSectionCollection object.(Overrides NameObjectCollectionBase::Keys.) |
| Name | Description | |
|---|---|---|
![]() | Add(String^, ConfigurationSection^) | Adds a ConfigurationSection object to the ConfigurationSectionCollection object. |
![]() | Clear() | Clears this ConfigurationSectionCollection object. |
![]() | CopyTo(array<ConfigurationSection^>^, Int32) | Copies this ConfigurationSectionCollection object to an array. |
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Get(Int32) | Gets the specified ConfigurationSection object contained in this ConfigurationSectionCollection object. |
![]() | Get(String^) | Gets the specified ConfigurationSection object contained in this ConfigurationSectionCollection object. |
![]() | GetEnumerator() | Gets an enumerator that can iterate through this ConfigurationSectionCollection object.(Overrides NameObjectCollectionBase::GetEnumerator().) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetKey(Int32) | Gets the key of the specified ConfigurationSection object contained in this ConfigurationSectionCollection object. |
![]() | GetObjectData(SerializationInfo^, StreamingContext) | Used by the system during serialization.(Overrides NameObjectCollectionBase::GetObjectData(SerializationInfo^, StreamingContext).) |
![]() | GetType() | |
![]() | OnDeserialization(Object^) | Implements the ISerializable interface and raises the deserialization event when the deserialization is complete.(Inherited from NameObjectCollectionBase.) |
![]() | Remove(String^) | Removes the specified ConfigurationSection object from this ConfigurationSectionCollection object. |
![]() | RemoveAt(Int32) | Removes the specified ConfigurationSection object from this ConfigurationSectionCollection object. |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | ICollection::CopyTo(Array^, Int32) | Copies the entire NameObjectCollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array.(Inherited from NameObjectCollectionBase.) |
![]() ![]() | ICollection::IsSynchronized | Gets a value indicating whether access to the NameObjectCollectionBase object is synchronized (thread safe).(Inherited from NameObjectCollectionBase.) |
![]() ![]() | ICollection::SyncRoot | Gets an object that can be used to synchronize access to the NameObjectCollectionBase object.(Inherited from NameObjectCollectionBase.) |
| Name | Description | |
|---|---|---|
![]() | AsParallel() | Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.) |
![]() | AsQueryable() | Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.) |
![]() | Cast<TResult>() | Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.) |
![]() | OfType<TResult>() | Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.) |
Use the ConfigurationSectionCollection class to iterate through a collection of ConfigurationSection objects. You can access this collection of objects using the Sections property or the Sections property.
The ConfigurationSectionCollection class is also used in the creation of custom types that extend the ConfigurationSection class.
The following code example shows how to use the ConfigurationSectionCollection class.
The following example is an excerpt of the configuration file used by the previous example.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="CustomSection"
type="Samples.AspNet.Configuration.CustomSection, ConfigurationSectionCollection, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" allowDefinition="Everywhere" allowExeDefinition="MachineToApplication" restartOnExternalChanges="true" />
</configSections>
<CustomSection fileName="default.txt" maxUsers="1000"
maxIdleTime="00:05:00" />
</configuration>
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.




