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 section 元素集合的 ClientTargetSection 元素。
它属于包含 ClientTarget 和 ClientTargetSection。
构造函数
| 名称 | 说明 |
|---|---|
| ClientTargetCollection() |
初始化 ClientTargetCollection 类的新实例。 |
属性
方法
显式接口实现
| 名称 | 说明 |
|---|---|
| ICollection.CopyTo(Array, Int32) |
将 ConfigurationElementCollection 复制到数组。 (继承自 ConfigurationElementCollection) |
扩展方法
| 名称 | 说明 |
|---|---|
| AsParallel(IEnumerable) |
启用查询的并行化。 |
| AsQueryable(IEnumerable) |
将 IEnumerable 转换为 IQueryable。 |
| Cast<TResult>(IEnumerable) |
将 IEnumerable 的元素强制转换为指定类型。 |
| OfType<TResult>(IEnumerable) |
根据指定类型筛选 IEnumerable 的元素。 |