PropertyDescriptorCollection.Count 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컬렉션의 속성 설명자 수를 가져옵니다.
public:
property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer
속성 값
컬렉션의 속성 설명자 수입니다.
구현
예제
다음 코드 예제에서는 속성을 사용 하 여 Count 속성 수를 인쇄 합니다 button1. 이를 요구 button1 하며 textBox1 양식에서 인스턴스화되었습니다.
private:
void GetCount()
{
// Creates a new collection and assign it the properties for button1.
PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 );
// Prints the number of properties on button1 in a textbox.
textBox1->Text = properties->Count.ToString();
}
void GetCount()
{
// Creates a new collection and assign it the properties for button1.
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);
// Prints the number of properties on button1 in a textbox.
textBox1.Text = properties.Count.ToString();
}
Private Sub GetCount()
' Creates a new collection and assign it the properties for button1.
Dim properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(button1)
' Prints the number of properties on button1 in a textbox.
textBox1.Text = properties.Count.ToString()
End Sub
설명
이 속성을 사용하여 Count 개체 컬렉션을 반복하는 루프의 제한을 설정할 수 있습니다. 컬렉션은 0부터 시작하므로 루프의 상한으로 사용해야 Count - 1 합니다.