ConfigurationCollectionAttribute(Type) Konstruktor
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Initierar en ny instans av ConfigurationCollectionAttribute klassen.
public:
ConfigurationCollectionAttribute(Type ^ itemType);
public ConfigurationCollectionAttribute(Type itemType);
new System.Configuration.ConfigurationCollectionAttribute : Type -> System.Configuration.ConfigurationCollectionAttribute
Public Sub New (itemType As Type)
Parametrar
- itemType
- Type
Typ av egenskapssamling som ska skapas.
Undantag
itemType är null.
Exempel
I följande exempel visas hur du ConfigurationCollectionAttributeanvänder .
// 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
Kommentarer
Du använder den här konstruktorn för att tala om för .NET Framework vilken anpassad typ av egenskapssamling som ska skapas.