ConfigurationPropertyCollection ConfigurationPropertyCollection ConfigurationPropertyCollection ConfigurationPropertyCollection Class

定义

表示配置元素属性的集合。Represents a collection of configuration-element properties.

public ref class ConfigurationPropertyCollection : System::Collections::ICollection
public class ConfigurationPropertyCollection : System.Collections.ICollection
type ConfigurationPropertyCollection = class
    interface ICollection
    interface IEnumerable
Public Class ConfigurationPropertyCollection
Implements ICollection
继承
ConfigurationPropertyCollectionConfigurationPropertyCollectionConfigurationPropertyCollectionConfigurationPropertyCollection
实现

示例

下面的示例演示了一种可能的ConfigurationPropertyCollection使用。The following example shows one possible use of the ConfigurationPropertyCollection. 请参阅相关类型ConfigurationProperty的示例。Refer to the example of the related type ConfigurationProperty.

下面是上述示例所使用配置的摘录。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>  

注解

类表示ConfigurationProperty对象的集合, 这些对象可以是配置元素的ConfigurationElement特性或对象。 ConfigurationPropertyCollectionThe ConfigurationPropertyCollection class represents the collection of the ConfigurationProperty objects that can be attributes or ConfigurationElement objects of a configuration element.

ConfigurationProperty类表示单独的配置设置。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.

构造函数

ConfigurationPropertyCollection() ConfigurationPropertyCollection() ConfigurationPropertyCollection() ConfigurationPropertyCollection()

初始化 ConfigurationPropertyCollection 类的新实例。Initializes a new instance of the ConfigurationPropertyCollection class.

属性

Count Count Count Count

获取集合中的属性数。Gets the number of properties in the collection.

IsSynchronized IsSynchronized IsSynchronized IsSynchronized

获取一个值,该值指示对集合的访问是否为同步的(线程安全)。Gets a value indicating whether access to the collection is synchronized (thread safe).

Item[String] Item[String] Item[String] Item[String]

获取具有指定名称的集合项。Gets the collection item with the specified name.

SyncRoot SyncRoot SyncRoot SyncRoot

获取用于同步对集合的访问的对象。Gets the object to synchronize access to the collection.

方法

Add(ConfigurationProperty) Add(ConfigurationProperty) Add(ConfigurationProperty) Add(ConfigurationProperty)

将配置属性添加到集合。Adds a configuration property to the collection.

Clear() Clear() Clear() Clear()

从集合中移除所有配置属性对象。Removes all configuration property objects from the collection.

Contains(String) Contains(String) Contains(String) Contains(String)

指定此集合中是否包含配置属性。Specifies whether the configuration property is contained in this collection.

CopyTo(ConfigurationProperty[], Int32) CopyTo(ConfigurationProperty[], Int32) CopyTo(ConfigurationProperty[], Int32) CopyTo(ConfigurationProperty[], Int32)

将此 ConfigurationPropertyCollection 复制到数组。Copies this ConfigurationPropertyCollection to an array.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

在将 IEnumerator 对象应用于集合时获取该对象。Gets the IEnumerator object as it applies to the collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(String) Remove(String) Remove(String) Remove(String)

从集合中移除配置属性。Removes a configuration property from the collection.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

显式界面实现

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

将此集合复制到数组。Copies this collection to an array.

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于

另请参阅