ClientTargetCollection 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示 ClientTarget 物件的集合。 此類別無法獲得繼承。
public ref class ClientTargetCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.ClientTarget))]
public sealed class ClientTargetCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.ClientTarget))>]
type ClientTargetCollection = class
inherit ConfigurationElementCollection
Public NotInheritable Class ClientTargetCollection
Inherits ConfigurationElementCollection
- 繼承
- 屬性
範例
下列程式代碼範例示範如何從現有 Web 應用程式的組態檔取得 ClientTargetCollection 物件。
// Get the Web application configuration.
System.Configuration.Configuration configuration =
WebConfigurationManager.OpenWebConfiguration(
"/aspnetTest");
// Get the <clientTarget> section.
ClientTargetSection clientTargetSection =
(ClientTargetSection)configuration.GetSection(
"system.web/clientTarget");
// Get the client target collection.
ClientTargetCollection clientTargets =
clientTargetSection.ClientTargets;
' Get the Web application configuration.
Dim configuration _
As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/aspnetTest")
' Get the <clientTarget> section.
Dim clientTargetSection _
As ClientTargetSection = _
CType(configuration.GetSection( _
"system.web/clientTarget"), _
ClientTargetSection)
' Get the client target collection.
Dim clientTargets _
As ClientTargetCollection = _
clientTargetSection.ClientTargets
下列範例顯示組態檔的摘錄。
<clientTarget>
<add alias=
"uplevel"
userAgent="Mozilla/5.0 (compatible;MSIE 6.0;Windows NT 5.1)"/>
<add alias="downlevel" userAgent="Generic Downlevel"/>
</clientTarget>
備註
型 ClientTargetCollection 別允許存取 ClientTarget 區段專案集合的專案 ClientTargetSection 。
它屬於包含 ClientTarget 和 ClientTargetSection的群組。
建構函式
| ClientTargetCollection() |
初始化 ClientTargetCollection 類別的新執行個體。 |
屬性
方法
明確介面實作
| ICollection.CopyTo(Array, Int32) |
將 ConfigurationElementCollection 複製至陣列。 (繼承來源 ConfigurationElementCollection) |
擴充方法
| Cast<TResult>(IEnumerable) |
將 IEnumerable 的項目轉換成指定的型別。 |
| OfType<TResult>(IEnumerable) |
根據指定的型別來篩選 IEnumerable 的項目。 |
| AsParallel(IEnumerable) |
啟用查詢的平行化作業。 |
| AsQueryable(IEnumerable) |
將 IEnumerable 轉換成 IQueryable。 |