ConfigurationElement.GetCollection Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns all configuration elements that belong to the current configuration element.
Overloads
GetCollection(String, Type) |
Returns the configuration element that has the specified name and type and is under the current configuration element. |
GetCollection(Type) |
Returns the configuration element that has the specified type and is under the current configuration element. |
GetCollection(String) |
Returns all configuration elements that belong to the current configuration element. |
GetCollection() |
Returns the default collection for the current configuration element. |
GetCollection(String, Type)
Returns the configuration element that has the specified name and type and is under the current configuration element.
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
Parameters
- collectionName
- String
The name of the element this method should return.
- collectionType
- Type
The common language runtime (CLR) type of the collection this method should return.
Returns
A ConfigurationElement object.
Exceptions
The collectionType
parameter is a null
.
Remarks
A child element collection that is represented in the ChildElements property differs from a nested element collection that is represented by the return value of the GetCollection method. Both collections contain ConfigurationElement objects. However, you should use the ChildElements property when you query the configuration for unique child elements such as the system.webServer/asp
configuration section. You should use the GetCollection method when you query the configuration for collection elements that contain a unique key or a multi-attribute key, such as the system.webServer/sites
configuration section
Applies to
GetCollection(Type)
Returns the configuration element that has the specified type and is under the current configuration element.
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
Parameters
- collectionType
- Type
The common language runtime (CLR) type of the collection this method should return.
Returns
A ConfigurationElement object.
Exceptions
The collectionType
parameter is null
or empty.
Remarks
A child element collection that is represented in the ChildElements property differs from a nested element collection that is represented by the return value of the GetCollection method. Both collections contain ConfigurationElement objects. However, you should use the ChildElements property when you query the configuration for unique child elements such as the system.webServer/asp
configuration section. You should use the GetCollection method when you query the configuration for collection elements that contain a unique key or a multi-attribute key, such as the system.webServer/sites
configuration section
Applies to
GetCollection(String)
Returns all configuration elements that belong to the current configuration element.
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
Parameters
- collectionName
- String
The name of the collection this method should return.
Returns
A ConfigurationElementCollection object.
Exceptions
The collectionName
parameter is null
or empty.
Applies to
GetCollection()
Returns the default collection for the current configuration element.
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
Returns
A ConfigurationElementCollection object that represents the default collection for the current configuration element.
Remarks
A child element collection that is represented in the ChildElements property differs from a nested element collection that is represented by the return value of the GetCollection method. Both collections contain ConfigurationElement objects. However, you should use the ChildElements property when you query the configuration for unique child elements such as the system.webServer/asp
configuration section. You should use the GetCollection method when you query the configuration for collection elements that contain a unique key or a multi-attribute key, such as the system.webServer/sites
configuration section.