AttributeCollection.Count Özellik
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.
Öznitelik sayısını alır.
public:
property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer
Özellik Değeri
Öznitelik sayısı.
Uygulamalar
Örnekler
Aşağıdaki kod örneği, özellik sayısını button1
bir metin kutusuna yazdırmak için özelliğini kullanırCount. Ve'nin button1
textBox1
bir formda oluşturulduğunu varsayar.
private:
void GetCount()
{
// Creates a new collection and assigns it the attributes for button1.
AttributeCollection^ attributes;
attributes = TypeDescriptor::GetAttributes( button1 );
// Prints the number of items in the collection.
textBox1->Text = attributes->Count.ToString();
}
private void GetCount() {
// Creates a new collection and assigns it the attributes for button1.
AttributeCollection attributes;
attributes = TypeDescriptor.GetAttributes(button1);
// Prints the number of items in the collection.
textBox1.Text = attributes.Count.ToString();
}
Private Sub GetCount
' Creates a new collection and assigns it the attributes for button 1.
Dim attributes As AttributeCollection
attributes = TypeDescriptor.GetAttributes(button1)
' Prints the number of items in the collection.
textBox1.Text = attributes.Count.ToString
End Sub
Açıklamalar
bir nesne koleksiyonu aracılığıyla yineleyen bir döngünün sınırlarını ayarlamak için özelliğini kullanabilirsiniz Count . Koleksiyon sıfır tabanlıysa, döngünün üst sınırı olarak kullandığınızdan Count - 1
emin olun.
Şunlara uygulanır
Ayrıca bkz.
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin