ConfigurationPropertyCollection 類別

定義

表示組態項目屬性的集合。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
繼承
ConfigurationPropertyCollection
實作

範例

下列範例顯示一種可能的使用 ConfigurationPropertyCollectionThe following example shows one possible use of the ConfigurationPropertyCollection. 請參閱相關類型的範例 ConfigurationPropertyRefer 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>  

備註

ConfigurationPropertyCollection類別表示物件的集合 ConfigurationProperty ,這些物件可以是設定 ConfigurationElement 元素的屬性或物件。The 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 類別的新執行個體。Initializes a new instance of the ConfigurationPropertyCollection class.

屬性

Count

取得集合中的屬性數目。Gets the number of properties in the collection.

IsSynchronized

取得值,表示是否同步化存取集合 (執行緒安全)。Gets a value indicating whether access to the collection is synchronized (thread safe).

Item[String]

取得具有指定之名稱的集合項目。Gets the collection item with the specified name.

SyncRoot

取得用於同步化存取集合的物件。Gets the object to synchronize access to the collection.

方法

Add(ConfigurationProperty)

將組態屬性加入集合。Adds a configuration property to the collection.

Clear()

移除集合中的所有組態屬性物件。Removes all configuration property objects from the collection.

Contains(String)

指定組態屬性是否包含在這個集合中。Specifies whether the configuration property is contained in this collection.

CopyTo(ConfigurationProperty[], Int32)

複製這個 ConfigurationPropertyCollection 至陣列。Copies this ConfigurationPropertyCollection to an array.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetEnumerator()

IEnumerator 物件套用至集合時取得它。Gets the IEnumerator object as it applies to the collection.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
Remove(String)

移除集合中的組態屬性。Removes a configuration property from the collection.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

明確介面實作

ICollection.CopyTo(Array, Int32)

複製這個集合至陣列。Copies this collection to an array.

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於

另請參閱