ListItemCollection Oluşturucu
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
ListItemCollection sınıfının yeni bir örneğini başlatır.
public:
ListItemCollection();
public ListItemCollection ();
Public Sub New ()
Örnekler
Aşağıdaki kod örneğinde nesne oluşturma ListItemCollection , koleksiyonlara öğe ekleme ve koleksiyonlardan öğeleri kaldırma işlemleri gösterilmektedir. Bu kodu tam olarak çalışan bir örnekte görüntülemek için sınıf konusuna WebControl bakın.
// Create a new ListItemCollection.
ListItemCollection listBoxData = new ListItemCollection();
// Add items to the collection.
listBoxData.Add(new ListItem("apples"));
listBoxData.Add(new ListItem("bananas"));
listBoxData.Add(new ListItem("cherries"));
listBoxData.Add("grapes");
listBoxData.Add("mangos");
listBoxData.Add("oranges");
// Set the ListItemCollection as the data source for ListBox1.
ListBox1.DataSource = listBoxData;
ListBox1.DataBind();
' Create a new ListItemCollection.
Dim listBoxData As New ListItemCollection()
' Add items to the collection.
listBoxData.Add(New ListItem("apples"))
listBoxData.Add(New ListItem("bananas"))
listBoxData.Add(New ListItem("cherries"))
listBoxData.Add("grapes")
listBoxData.Add("mangos")
listBoxData.Add("oranges")
' Set the ListItemCollection as the data source for ListBox1.
ListBox1.DataSource = listBoxData
ListBox1.DataBind()
Açıklamalar
Varsayılan değerleri kullanarak sınıfın yeni bir örneğini oluşturmak ve başlatmak için bu oluşturucuyu ListItemCollection kullanın.