ConfigurationElement.GetCollection 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回属于当前配置元素的所有配置元素。
重载
GetCollection(String, Type) |
返回具有指定名称和类型的配置元素,并且位于当前配置元素下。 |
GetCollection(Type) |
返回具有指定类型且位于当前配置元素下的配置元素。 |
GetCollection(String) |
返回属于当前配置元素的所有配置元素。 |
GetCollection() |
返回当前配置元素的默认集合。 |
GetCollection(String, Type)
返回具有指定名称和类型的配置元素,并且位于当前配置元素下。
public:
Microsoft::Web::Administration::ConfigurationElement ^ GetCollection(System::String ^ collectionName, Type ^ collectionType);
public Microsoft.Web.Administration.ConfigurationElement GetCollection (string collectionName, Type collectionType);
member this.GetCollection : string * Type -> Microsoft.Web.Administration.ConfigurationElement
Public Function GetCollection (collectionName As String, collectionType As Type) As ConfigurationElement
参数
- collectionName
- String
此方法应返回的元素的名称。
- collectionType
- Type
公共语言运行时 (CLR) 此方法应返回的集合的类型。
返回
例外
collectionType
参数为 null
。
注解
属性中 ChildElements 表示的子元素集合不同于由 方法的返回值表示的 GetCollection 嵌套元素集合。 这两个集合都包含 ConfigurationElement 对象。 但是,在查询配置的唯一子元素(例如system.webServer/asp
配置部分)时,应使用 ChildElements 属性。 查询包含唯一键或多属性键的集合元素的配置时,应使用 GetCollection 方法,例如 system.webServer/sites
配置节
适用于
GetCollection(Type)
返回具有指定类型且位于当前配置元素下的配置元素。
public:
Microsoft::Web::Administration::ConfigurationElement ^ GetCollection(Type ^ collectionType);
public Microsoft.Web.Administration.ConfigurationElement GetCollection (Type collectionType);
member this.GetCollection : Type -> Microsoft.Web.Administration.ConfigurationElement
Public Function GetCollection (collectionType As Type) As ConfigurationElement
参数
- collectionType
- Type
公共语言运行时 (CLR) 此方法应返回的集合的类型。
返回
例外
collectionType
参数为 null
或为空。
注解
属性中 ChildElements 表示的子元素集合不同于由 方法的返回值表示的 GetCollection 嵌套元素集合。 这两个集合都包含 ConfigurationElement 对象。 但是,在查询配置的唯一子元素(例如system.webServer/asp
配置部分)时,应使用 ChildElements 属性。 查询包含唯一键或多属性键的集合元素的配置时,应使用 GetCollection 方法,例如 system.webServer/sites
配置节
适用于
GetCollection(String)
返回属于当前配置元素的所有配置元素。
public:
Microsoft::Web::Administration::ConfigurationElementCollection ^ GetCollection(System::String ^ collectionName);
public Microsoft.Web.Administration.ConfigurationElementCollection GetCollection (string collectionName);
member this.GetCollection : string -> Microsoft.Web.Administration.ConfigurationElementCollection
Public Function GetCollection (collectionName As String) As ConfigurationElementCollection
参数
- collectionName
- String
此方法应返回的集合的名称。
返回
ConfigurationElementCollection 对象。
例外
collectionName
参数为 null
或为空。
适用于
GetCollection()
返回当前配置元素的默认集合。
public:
Microsoft::Web::Administration::ConfigurationElementCollection ^ GetCollection();
public Microsoft.Web.Administration.ConfigurationElementCollection GetCollection ();
member this.GetCollection : unit -> Microsoft.Web.Administration.ConfigurationElementCollection
Public Function GetCollection () As ConfigurationElementCollection
返回
一个 ConfigurationElementCollection 对象,表示当前配置元素的默认集合。
注解
属性中 ChildElements 表示的子元素集合不同于由 方法的返回值表示的 GetCollection 嵌套元素集合。 这两个集合都包含 ConfigurationElement 对象。 但是,在查询配置的唯一子元素(例如system.webServer/asp
配置部分)时,应使用 ChildElements 属性。 在查询包含唯一键或多属性键(例如system.webServer/sites
配置节)的集合元素的配置时,应使用 GetCollection 方法。