ConfigurationCollectionAttribute(Type) ConfigurationCollectionAttribute(Type) ConfigurationCollectionAttribute(Type) ConfigurationCollectionAttribute(Type) Constructor

定義

ConfigurationCollectionAttribute クラスの新しいインスタンスを初期化します。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)

パラメーター

itemType
Type Type Type Type

作成するプロパティのコレクションの型。The type of the property collection to create.

例外

を使用ConfigurationCollectionAttributeする方法を次の例に示します。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

注釈

このコンストラクターを使用して、作成するプロパティコレクションのカスタム型を .NET Framework に指示します。You use this constructor to tell the .NET Framework the custom type of the property collection to be created.

適用対象