EventDescriptorCollection.Count 속성

정의

컬렉션에 있는 이벤트 설명자의 개수를 가져옵니다.

public:
 property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer

속성 값

컬렉션에 있는 이벤트 설명자의 개수입니다.

구현

예제

다음 코드 예제를 사용 하 여는 Count 속성에 연결 된 이벤트의 수를 인쇄 합니다 button1. 및 가 button1textBox1 양식에서 인스턴스화되어야 합니다.

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();
   }
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();
 }
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

설명

속성은 Count 개체 컬렉션을 반복하는 루프의 제한을 설정하는 데 사용할 수 있습니다. 컬렉션은 0에서 시작 하는 경우 사용 해야 Count - 1 루프의 상한값으로 합니다.

참고

합니다 HostProtectionAttribute 이 클래스에 적용 된 특성에는 다음과 같은 Resources 속성 값: Synchronization합니다. HostProtectionAttribute는 대개 아이콘을 두 번 클릭하거나, 명령을 입력하거나, 브라우저에서 URL을 입력하여 시작되는 데스크톱 애플리케이션에 영향을 미치지 않습니다. 자세한 내용은 참조는 HostProtectionAttribute 클래스 또는 SQL Server 프로그래밍 및 호스트 보호 특성합니다.

적용 대상

추가 정보