Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft die Anzahl der Eigenschaftenbezeichner in der Auflistung ab.
Namespace: System.ComponentModel
Assembly: System (in system.dll)
Syntax
'Declaration
Public ReadOnly Property Count As Integer
'Usage
Dim instance As PropertyDescriptorCollection
Dim value As Integer
value = instance.Count
public int Count { get; }
public:
property int Count {
int get ();
}
/** @property */
public int get_Count ()
public function get Count () : int
Eigenschaftenwert
Die Anzahl der Eigenschaftenbezeichner in der Auflistung.
Hinweise
Mit der Count-Eigenschaft können Sie die Begrenzungen einer Schleife festlegen, die eine Auflistung von Objekten durchläuft. Da die Auflistung nullbasiert ist, müssen Sie Count - 1 als obere Grenze der Schleife festlegen.
Beispiel
Im folgenden Codebeispiel wird die Anzahl der Eigenschaften von button1 mithilfe der Count-Eigenschaft ausgegeben. Dafür ist es erforderlich, dass button1 und textBox1 in einem Formular instanziiert wurden.
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
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();
}
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();
}
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.set_Text(System.Convert.ToString(properties.get_Count()));
} //GetCount
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
PropertyDescriptorCollection-Klasse
PropertyDescriptorCollection-Member
System.ComponentModel-Namespace
PropertyDescriptor-Klasse
TypeDescriptor