Bagikan melalui


ConfigurationCollectionAttribute.AddItemName Properti

Definisi

Mendapatkan atau mengatur nama <add> elemen konfigurasi.

public:
 property System::String ^ AddItemName { System::String ^ get(); void set(System::String ^ value); };
public string AddItemName { get; set; }
member this.AddItemName : string with get, set
Public Property AddItemName As String

Nilai Properti

Nama yang menggantikan nama standar "tambahkan" untuk item konfigurasi.

Contoh

Contoh berikut menunjukkan cara menggunakan AddItemName properti .

// 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

Keterangan

Properti AddItemName memungkinkan Anda menetapkan nama yang berbeda ke elemen konfigurasi. Misalnya, Anda dapat menggunakan addUrl alih-alih "tambahkan".

Berlaku untuk