Aracılığıyla paylaş


EventDescriptorCollection.Count Özellik

Tanım

Koleksiyondaki olay tanımlayıcılarının 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

Koleksiyondaki olay tanımlayıcılarının sayısı.

Uygulamalar

Örnekler

Aşağıdaki kod örneği, Count öğesine eklenen olay sayısını yazdırmak için button1özelliğini kullanır. Bunu gerektirir button1 ve textBox1 bir formda örneklenmiştir.

private:
   void GetCount()
   {
      // Creates a new collection and assigns it the events for button1.
      EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 );
      
      // Prints the number of events on button1 in a text box.
      textBox1->Text = events->Count.ToString();
   }
void GetCount()
{
    // Creates a new collection and assigns it the events for button1.
    EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);

    // Prints the number of events on button1 in a text box.
    textBox1.Text = events.Count.ToString();
}
Private Sub GetCount()
    ' Creates a new collection and assigns it the events for button1.
    Dim events As EventDescriptorCollection = TypeDescriptor.GetEvents(button1)
    
    ' Prints the number of events on button1 in a text box.
    textBox1.Text = events.Count.ToString()
End Sub

Açıklamalar

özelliği, Count bir nesne koleksiyonu aracılığıyla yineleyen bir döngünün sınırlarını ayarlamak için kullanılabilir. Koleksiyon sıfır tabanlıysa, döngünün üst sınırı olarak kullandığınızdan Count - 1 emin olun.

Uyarı

Bu HostProtectionAttribute sınıfa uygulanan öznitelik şu Resources özellik değerine sahiptir: Synchronization. HostProtectionAttribute masaüstü uygulamalarını etkilemez (genellikle bir simgeye çift tıklayarak, komut yazarak veya bir tarayıcıya URL girerek başlatılır). Daha fazla bilgi için bkz HostProtectionAttribute . sınıf veya SQL Server Programlama ve Konak Koruması Öznitelikleri.

Şunlara uygulanır

Ayrıca bkz.