ConfigurationCollectionAttribute(Type) Constructor
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.
Initializes a new instance of the ConfigurationCollectionAttribute class.
public:
ConfigurationCollectionAttribute(Type ^ itemType);
public ConfigurationCollectionAttribute (Type itemType);
new System.Configuration.ConfigurationCollectionAttribute : Type -> System.Configuration.ConfigurationCollectionAttribute
Public Sub New (itemType As Type)
Parameters
- itemType
- Type
The type of the property collection to create.
Exceptions
itemType
is null
.
Examples
The following example shows how to use the ConfigurationCollectionAttribute.
// Declare the Urls collection property using the
// ConfigurationCollectionAttribute.
// This allows to build a nested section that contains
// a collection of elements.
[ConfigurationProperty("urls", IsDefaultCollection = false)]
[ConfigurationCollection(typeof(UrlsCollection),
AddItemName = "add",
ClearItemsName = "clear",
RemoveItemName = "remove")]
public UrlsCollection Urls
{
get
{
UrlsCollection urlsCollection =
(UrlsCollection)base["urls"];
return urlsCollection;
}
}
' Declare the Urls collection property using the
' ConfigurationCollectionAttribute.
' This allows to build a nested section that contains
' a collection of elements.
<ConfigurationProperty("urls", IsDefaultCollection:=False),
System.Configuration.ConfigurationCollection(GetType(UrlsCollection),
AddItemName:="add", ClearItemsName:="clear", RemoveItemName:="remove")> _
Public ReadOnly Property Urls() As UrlsCollection
Get
Dim urlsCollection As UrlsCollection = CType(MyBase.Item("urls"), UrlsCollection)
Return urlsCollection
End Get
End Property
Remarks
You use this constructor to tell the .NET Framework the custom type of the property collection to be created.
Applies to
Surađujte s nama na GitHubu
Izvor za ovaj sadržaj možete pronaći na GitHubu, gdje možete stvarati i pregledavati probleme i zahtjeve za povlačenjem. Dodatne informacije potražite u našem vodiču za suradnike.