ClientTargetCollection 类
定义
表示 ClientTarget 对象集合。Represents a collection of ClientTarget objects. 此类不能被继承。This class cannot be inherited.
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
- 继承
- 属性
示例
下面的代码示例演示如何 ClientTargetCollection 从现有 Web 应用程序的配置文件中获取该对象。The following code example shows how to obtain the ClientTargetCollection object from the configuration file of an existing Web application.
// 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
下面的示例演示了配置文件中的摘录。The following example shows an excerpt from the configuration file.
<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 section 元素集合的元素。The ClientTargetCollection type allows access to the ClientTarget elements of the ClientTargetSection section element collection.
它属于包含和的组 ClientTarget ClientTargetSection 。It belongs to a group that includes ClientTarget and ClientTargetSection.
构造函数
| ClientTargetCollection() |
初始化 ClientTargetCollection 类的新实例。Initializes a new instance of the ClientTargetCollection class. |
属性
| AddElementName |
在派生的类中重写时,获取或设置 ConfigurationElement 的名称,以便在 ConfigurationElementCollection 中与添加操作关联。Gets or sets the name of the ConfigurationElement to associate with the add operation in the ConfigurationElementCollection when overridden in a derived class. (继承自 ConfigurationElementCollection) |
| AllKeys |
返回 ClientTargetCollection 集合中包含的所有配置元素的键数组。Returns an array of the keys for all the configuration elements contained in the ClientTargetCollection collection. |
| ClearElementName |
在派生的类中重写时,获取或设置 ConfigurationElement 的名称,以便在 ConfigurationElementCollection 中与清除操作关联。Gets or sets the name for the ConfigurationElement to associate with the clear operation in the ConfigurationElementCollection when overridden in a derived class. (继承自 ConfigurationElementCollection) |
| CollectionType |
获取 ConfigurationElementCollection 的类型。Gets the type of the ConfigurationElementCollection. (继承自 ConfigurationElementCollection) |
| Count |
获取集合中的元素数。Gets the number of elements in the collection. (继承自 ConfigurationElementCollection) |
| CurrentConfiguration |
获取对顶级 Configuration 实例的引用,该实例表示当前 ConfigurationElement 实例所属的配置层次结构。Gets a reference to the top-level Configuration instance that represents the configuration hierarchy that the current ConfigurationElement instance belongs to. (继承自 ConfigurationElement) |
| ElementInformation |
获取包含 ConfigurationElement 对象的不可自定义的信息和功能的 ElementInformation 对象。Gets an ElementInformation object that contains the non-customizable information and functionality of the ConfigurationElement object. (继承自 ConfigurationElement) |
| ElementName |
获取在派生的类中重写时用于标识配置文件中此元素集合的名称。Gets the name used to identify this collection of elements in the configuration file when overridden in a derived class. (继承自 ConfigurationElementCollection) |
| ElementProperty |
获取表示 ConfigurationElement 对象本身的 ConfigurationElementProperty 对象。Gets the ConfigurationElementProperty object that represents the ConfigurationElement object itself. (继承自 ConfigurationElement) |
| EmitClear |
获取或设置一个值,该值指定是否已清除集合。Gets or sets a value that specifies whether the collection has been cleared. (继承自 ConfigurationElementCollection) |
| EvaluationContext |
获取 ConfigurationElement 对象的 ContextInformation 对象。Gets the ContextInformation object for the ConfigurationElement object. (继承自 ConfigurationElement) |
| HasContext |
获取一个值,该值指示 CurrentConfiguration 属性是否为 |
| IsSynchronized |
获取一个值,该值指示是否同步对集合的访问。Gets a value indicating whether access to the collection is synchronized. (继承自 ConfigurationElementCollection) |
| Item[ConfigurationProperty] |
获取或设置此配置元素的属性或特性。Gets or sets a property or attribute of this configuration element. (继承自 ConfigurationElement) |
| Item[Int32] |
获取位于指定索引位置的 ClientTarget 对象。Gets the ClientTarget object at the specified index. |
| Item[String] |
获取具有指定名称的 ClientTarget 对象。Gets the ClientTarget object with the specified name. |
| LockAllAttributesExcept |
获取被锁定的特性的集合。Gets the collection of locked attributes. (继承自 ConfigurationElement) |
| LockAllElementsExcept |
获取被锁定的元素的集合。Gets the collection of locked elements. (继承自 ConfigurationElement) |
| LockAttributes |
获取被锁定的特性的集合。Gets the collection of locked attributes. (继承自 ConfigurationElement) |
| LockElements |
获取被锁定的元素的集合。Gets the collection of locked elements. (继承自 ConfigurationElement) |
| LockItem |
获取或设置一个值,该值指示是否已锁定该元素。Gets or sets a value indicating whether the element is locked. (继承自 ConfigurationElement) |
| Properties |
获取属性的集合。Gets the collection of properties. (继承自 ConfigurationElement) |
| RemoveElementName |
在派生的类中重写时,获取或设置 ConfigurationElement 的名称,以便在 ConfigurationElementCollection 中与移除操作关联。Gets or sets the name of the ConfigurationElement to associate with the remove operation in the ConfigurationElementCollection when overridden in a derived class. (继承自 ConfigurationElementCollection) |
| SyncRoot |
获取用于同步对 ConfigurationElementCollection 的访问的对象。Gets an object used to synchronize access to the ConfigurationElementCollection. (继承自 ConfigurationElementCollection) |
| ThrowOnDuplicate |
获取一个值,该值指示尝试向 ConfigurationElement 添加重复的 ConfigurationElementCollection 是否会导致引发异常。Gets a value indicating whether an attempt to add a duplicate ConfigurationElement to the ConfigurationElementCollection will cause an exception to be thrown. (继承自 ConfigurationElementCollection) |
方法
| Add(ClientTarget) |
将指定的 ClientTarget 对象添加到集合。Adds the specified ClientTarget object to the collection. |
| BaseAdd(ConfigurationElement) |
向 ConfigurationElementCollection 添加配置元素。Adds a configuration element to the ConfigurationElementCollection. (继承自 ConfigurationElementCollection) |
| BaseAdd(ConfigurationElement, Boolean) |
向配置元素集合添加配置元素。Adds a configuration element to the configuration element collection. (继承自 ConfigurationElementCollection) |
| BaseAdd(Int32, ConfigurationElement) |
向配置元素集合添加配置元素。Adds a configuration element to the configuration element collection. (继承自 ConfigurationElementCollection) |
| BaseClear() |
从集合中移除所有配置元素对象。Removes all configuration element objects from the collection. (继承自 ConfigurationElementCollection) |
| BaseGet(Int32) |
获取位于指定索引位置的配置元素。Gets the configuration element at the specified index location. (继承自 ConfigurationElementCollection) |
| BaseGet(Object) |
返回具有指定键的配置元素。Returns the configuration element with the specified key. (继承自 ConfigurationElementCollection) |
| BaseGetAllKeys() |
返回 ConfigurationElementCollection 中包含的所有配置元素的键数组。Returns an array of the keys for all of the configuration elements contained in the ConfigurationElementCollection. (继承自 ConfigurationElementCollection) |
| BaseGetKey(Int32) |
获取位于指定索引位置的 ConfigurationElement 的键。Gets the key for the ConfigurationElement at the specified index location. (继承自 ConfigurationElementCollection) |
| BaseIndexOf(ConfigurationElement) |
获取指定的 ConfigurationElement 的索引。Indicates the index of the specified ConfigurationElement. (继承自 ConfigurationElementCollection) |
| BaseIsRemoved(Object) |
指示是否已从 ConfigurationElement 中移除具有指定键的 ConfigurationElementCollection。Indicates whether the ConfigurationElement with the specified key has been removed from the ConfigurationElementCollection. (继承自 ConfigurationElementCollection) |
| BaseRemove(Object) |
从集合中删除 ConfigurationElement 对象。Removes a ConfigurationElement from the collection. (继承自 ConfigurationElementCollection) |
| BaseRemoveAt(Int32) |
移除位于指定索引位置的 ConfigurationElement。Removes the ConfigurationElement at the specified index location. (继承自 ConfigurationElementCollection) |
| Clear() |
从集合中移除所有 ClientTarget 对象。Removes all the ClientTarget objects from the collection. |
| CopyTo(ConfigurationElement[], Int32) |
将 ConfigurationElementCollection 的内容复制到数组。Copies the contents of the ConfigurationElementCollection to an array. (继承自 ConfigurationElementCollection) |
| CreateNewElement() |
在派生的类中重写时,创建一个新的 ConfigurationElement。When overridden in a derived class, creates a new ConfigurationElement. (继承自 ConfigurationElementCollection) |
| CreateNewElement(String) |
在派生的类中重写时,创建新的 ConfigurationElement。Creates a new ConfigurationElement when overridden in a derived class. (继承自 ConfigurationElementCollection) |
| DeserializeElement(XmlReader, Boolean) |
从配置文件读取 XML。Reads XML from the configuration file. (继承自 ConfigurationElement) |
| Equals(Object) |
将 ConfigurationElementCollection 与指定的对象进行比较。Compares the ConfigurationElementCollection to the specified object. (继承自 ConfigurationElementCollection) |
| GetElementKey(ConfigurationElement) |
在派生类中重写时获取指定配置元素的元素键。Gets the element key for a specified configuration element when overridden in a derived class. (继承自 ConfigurationElementCollection) |
| GetEnumerator() |
获取用于循环访问 IEnumerator 的 ConfigurationElementCollection。Gets an IEnumerator which is used to iterate through the ConfigurationElementCollection. (继承自 ConfigurationElementCollection) |
| GetHashCode() |
获取表示 ConfigurationElementCollection 实例的唯一值。Gets a unique value representing the ConfigurationElementCollection instance. (继承自 ConfigurationElementCollection) |
| GetKey(Int32) |
获取指定元素的集合键。Gets the collection key for the specified element. |
| GetTransformedAssemblyString(String) |
返回指定程序集名称的转换版本。Returns the transformed version of the specified assembly name. (继承自 ConfigurationElement) |
| GetTransformedTypeString(String) |
返回指定类型名称的转换版本。Returns the transformed version of the specified type name. (继承自 ConfigurationElement) |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| Init() |
将 ConfigurationElement 对象设置为其初始状态。Sets the ConfigurationElement object to its initial state. (继承自 ConfigurationElement) |
| InitializeDefault() |
用于初始化 ConfigurationElement 对象的默认值集。Used to initialize a default set of values for the ConfigurationElement object. (继承自 ConfigurationElement) |
| IsElementName(String) |
指示指定的 ConfigurationElement 是否存在于 ConfigurationElementCollection 中。Indicates whether the specified ConfigurationElement exists in the ConfigurationElementCollection. (继承自 ConfigurationElementCollection) |
| IsElementRemovable(ConfigurationElement) |
指示是否可从 ConfigurationElement 中移除指定 ConfigurationElementCollection。Indicates whether the specified ConfigurationElement can be removed from the ConfigurationElementCollection. (继承自 ConfigurationElementCollection) |
| IsModified() |
在派生的类中重写时,指示从最后一次保存或加载此 ConfigurationElementCollection 后是否对其进行了修改。Indicates whether this ConfigurationElementCollection has been modified since it was last saved or loaded when overridden in a derived class. (继承自 ConfigurationElementCollection) |
| IsReadOnly() |
指示 ConfigurationElementCollection 对象是否为只读的。Indicates whether the ConfigurationElementCollection object is read only. (继承自 ConfigurationElementCollection) |
| ListErrors(IList) |
将此 ConfigurationElement 对象以及所有子元素中无效属性的错误添加到传递的列表中。Adds the invalid-property errors in this ConfigurationElement object, and in all subelements, to the passed list. (继承自 ConfigurationElement) |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| OnDeserializeUnrecognizedAttribute(String, String) |
获取一个值,该值指示反序列化过程中是否遇到未知特性。Gets a value indicating whether an unknown attribute is encountered during deserialization. (继承自 ConfigurationElement) |
| OnDeserializeUnrecognizedElement(String, XmlReader) |
导致配置系统引发异常。Causes the configuration system to throw an exception. (继承自 ConfigurationElementCollection) |
| OnRequiredPropertyNotFound(String) |
找不到所需属性时引发异常。Throws an exception when a required property is not found. (继承自 ConfigurationElement) |
| PostDeserialize() |
反序列化后调用。Called after deserialization. (继承自 ConfigurationElement) |
| PreSerialize(XmlWriter) |
在序列化之前调用。Called before serialization. (继承自 ConfigurationElement) |
| Remove(ClientTarget) |
从集合中移除指定的 ClientTarget 对象。Removes the specified ClientTarget object from the collection. |
| Remove(String) |
从集合中移除具有指定别名的 ClientTarget 对象。Removes the ClientTarget object with the specified alias from the collection. |
| RemoveAt(Int32) |
具有指定集合索引的 ClientTarget 对象。Removes the ClientTarget object with the specified collection index. |
| Reset(ConfigurationElement) |
在派生的类中重写时,将 ConfigurationElementCollection 重置为其未被修改时的状态。Resets the ConfigurationElementCollection to its unmodified state when overridden in a derived class. (继承自 ConfigurationElementCollection) |
| ResetModified() |
在派生的类中重写时,将 IsModified() 属性的值重置为 |
| SerializeElement(XmlWriter, Boolean) |
在派生的类中重写时,将配置数据写入配置文件中的 XML 元素。Writes the configuration data to an XML element in the configuration file when overridden in a derived class. (继承自 ConfigurationElementCollection) |
| SerializeToXmlElement(XmlWriter, String) |
当在派生类中实现后,将此配置元素的外部标记写入配置文件。Writes the outer tags of this configuration element to the configuration file when implemented in a derived class. (继承自 ConfigurationElement) |
| SetPropertyValue(ConfigurationProperty, Object, Boolean) |
将属性设置为指定值。Sets a property to the specified value. (继承自 ConfigurationElement) |
| SetReadOnly() |
为 IsReadOnly() 对象和所有子元素设置 ConfigurationElementCollection 属性。Sets the IsReadOnly() property for the ConfigurationElementCollection object and for all sub-elements. (继承自 ConfigurationElementCollection) |
| ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |
| Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode) |
反转从配置层次结构的不同级别合并配置信息的效果。Reverses the effect of merging configuration information from different levels of the configuration hierarchy. (继承自 ConfigurationElementCollection) |
显式接口实现
| ICollection.CopyTo(Array, Int32) |
将 ConfigurationElementCollection 复制到数组。Copies the ConfigurationElementCollection to an array. (继承自 ConfigurationElementCollection) |
扩展方法
| 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 转换为 IQueryable。Converts an IEnumerable to an IQueryable. |