AttributeCollection.Count 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
특성 수를 가져옵니다.
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();
}
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 합니다.