ConfigurationCollectionAttribute(Type) Constructor

Definición

Inicializa una nueva instancia de la clase ConfigurationCollectionAttribute.

public:
 ConfigurationCollectionAttribute(Type ^ itemType);
public ConfigurationCollectionAttribute (Type itemType);
new System.Configuration.ConfigurationCollectionAttribute : Type -> System.Configuration.ConfigurationCollectionAttribute
Public Sub New (itemType As Type)

Parámetros

itemType
Type

Tipo de la colección de propiedades que se va a crear.

Excepciones

itemType es null.

Ejemplos

En el ejemplo siguiente se muestra cómo usar .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

Comentarios

Este constructor se usa para indicar a .NET Framework el tipo personalizado de la colección de propiedades que se va a crear.

Se aplica a