AttributeCollection.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 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

설명

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

적용 대상

추가 정보