ConfigurationPropertyCollection 类

定义

表示 configuration-element 属性的集合。

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
继承
ConfigurationPropertyCollection
实现

示例

下面的示例演示了一种可能的用法 ConfigurationPropertyCollection。 请参阅相关类型的 ConfigurationProperty示例。

下面是上述示例使用的配置的摘录。

<?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>

注解

ConfigurationPropertyCollection类表示可以是配置元素的属性或ConfigurationProperty对象的对象的对象的集合ConfigurationElement

ConfigurationProperty 类表示单个配置设置。 它允许获取或设置特定配置实体的名称、类型和默认值(属性或元素)。 通过其他选项,可以指定属性是必需属性、是元素键还是表示默认元素集合。

构造函数

名称 说明
ConfigurationPropertyCollection()

初始化 ConfigurationPropertyCollection 类的新实例。

属性

名称 说明
Count

获取集合中的属性数。

IsSynchronized

获取一个值,该值指示是否同步对集合的访问(线程安全)。

Item[String]

获取具有指定名称的集合项。

SyncRoot

获取要同步对集合的访问的对象。

方法

名称 说明
Add(ConfigurationProperty)

将配置属性添加到集合。

Clear()

从集合中删除所有配置属性对象。

Contains(String)

指定配置属性是否包含在此集合中。

CopyTo(ConfigurationProperty[], Int32)

将此 ConfigurationPropertyCollection 复制到数组。

Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
GetEnumerator()

IEnumerator获取应用于集合的对象。

GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
Remove(String)

从集合中删除配置属性。

ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

显式接口实现

名称 说明
ICollection.CopyTo(Array, Int32)

将此集合复制到数组。

扩展方法

名称 说明
AsParallel(IEnumerable)

启用查询的并行化。

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryable

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定类型。

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。

适用于

另请参阅