Skip to main content
.NET Framework Class Library
ConfigurationPropertyCollection Class

Represents a collection of configuration-element properties.

Inheritance Hierarchy
SystemObject
  System.ConfigurationConfigurationPropertyCollection

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)
Syntax
Public Class ConfigurationPropertyCollection _
	Implements [%$TOPIC/097akeh5_en-us_VS_110_2_0_0_0_0%], [%$TOPIC/097akeh5_en-us_VS_110_2_0_0_0_1%]
public class ConfigurationPropertyCollection : [%$TOPIC/097akeh5_en-us_VS_110_2_0_1_0_0%], 
	[%$TOPIC/097akeh5_en-us_VS_110_2_0_1_0_1%]
public ref class ConfigurationPropertyCollection : [%$TOPIC/097akeh5_en-us_VS_110_2_0_2_0_0%], 
	[%$TOPIC/097akeh5_en-us_VS_110_2_0_2_0_1%]
type ConfigurationPropertyCollection =  
    class 
        interface [%$TOPIC/097akeh5_en-us_VS_110_2_0_3_0_0%] 
        interface [%$TOPIC/097akeh5_en-us_VS_110_2_0_3_0_1%] 
    end

The ConfigurationPropertyCollection type exposes the following members.

Constructors
  NameDescription
Public method ConfigurationPropertyCollectionInitializes a new instance of the ConfigurationPropertyCollection class.
Top
Properties
  NameDescription
Public property CountGets the number of properties in the collection.
Public property IsSynchronizedGets a value indicating whether access to the collection is synchronized (thread safe).
Public property ItemGets the collection item with the specified name.
Public property SyncRootGets the object to synchronize access to the collection.
Top
Methods
  NameDescription
Public method AddAdds a configuration property to the collection.
Public method ClearRemoves all configuration property objects from the collection.
Public method ContainsSpecifies whether the configuration property is contained in this collection.
Public method CopyToCopies this ConfigurationPropertyCollection to an array.
Public method Equals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetEnumeratorGets the IEnumerator object as it applies to the collection.
Public method GetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public method RemoveRemoves a configuration property from the collection.
Public method ToStringReturns a string that represents the current object. (Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension Method AsParallelEnables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension Method AsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension Method CastTResultCasts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension Method OfTypeTResultFilters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implemetation Private method ICollectionCopyToCopies this collection to an array.
Top
Remarks

The ConfigurationPropertyCollection class represents the collection of the ConfigurationProperty objects that can be attributes or ConfigurationElement objects of a configuration element.

The ConfigurationProperty class represents an individual configuration setting. It allows you to get or set the name, type, and default value for a particular configuration entity (attribute or element). Additional options allow you to specify whether the attribute is required, is an element key, or represents a default element collection.

Examples

The following example shows one possible use of the ConfigurationPropertyCollection. Refer to the example of the related type ConfigurationProperty.

<configuration>
  <configSections>
    <section name="CustomSection" type="ConfigurationPropertyExample.CustomSection, ConfigurationPropertyExample" 
      allowDefinition="Everywhere" allowExeDefinition="MachineToApplication" 
      restartOnExternalChanges="true" />
  </configSections>
  <CustomSection fileName="override.txt" alias="alias.txt" 
    maxUsers="1000" maxIdleTime="00:05:00" />
</configuration>

The following is an excerpt from the configuration used by the above example.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="CustomSection" type="Samples.AspNet, ConfigurationProperty, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" allowDefinition="Everywhere" allowExeDefinition="MachineToApplication" restartOnExternalChanges="true" />
    </configSections>
    <CustomSection fileName="default.txt" alias="alias.txt" maxUsers="1000"
      maxIdleTime="00:05:00" />
</configuration>
Version Information

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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