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.
Gibt einen Enumerator für diese Klasse zurück.
Namespace: System.ComponentModel
Assembly: System (in system.dll)
Syntax
'Declaration
Public Overridable Function GetEnumerator As IEnumerator
'Usage
Dim instance As PropertyDescriptorCollection
Dim returnValue As IEnumerator
returnValue = instance.GetEnumerator
public virtual IEnumerator GetEnumerator ()
public:
virtual IEnumerator^ GetEnumerator ()
public IEnumerator GetEnumerator ()
public function GetEnumerator () : IEnumerator
Rückgabewert
Ein Enumerator vom Typ IEnumerator.
Beispiel
Im folgenden Codebeispiel wird ein Enumerator für die Eigenschaften von button1 abgerufen. Mit diesem Enumerator werden die Namen der Eigenschaften in die Auflistung ausgegeben. Dafür ist es erforderlich, dass button1 und textBox1 in einem Formular instanziiert wurden.
Private Sub MyEnumerator()
' Creates a new collection and assigns it the properties for button1.
Dim properties As PropertyDescriptorCollection = _
TypeDescriptor.GetProperties(button1)
' Creates an enumerator.
Dim ie As IEnumerator = properties.GetEnumerator()
' Prints the name of each property in the collection.
Dim myProperty As Object
While ie.MoveNext() = True
myProperty = ie.Current
textBox1.Text &= myProperty.ToString() & ControlChars.Cr
End While
End Sub
private void MyEnumerator() {
// Creates a new collection and assigns it the properties for button1.
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);
// Creates an enumerator.
IEnumerator ie = properties.GetEnumerator();
// Prints the name of each property in the collection.
Object myProperty;
while(ie.MoveNext()==true) {
myProperty = ie.Current;
textBox1.Text += myProperty.ToString() + '\n';
}
}
private:
void MyEnumerator()
{
// Creates a new collection and assigns it the properties for button1.
PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 );
// Creates an enumerator.
IEnumerator^ ie = properties->GetEnumerator();
// Prints the name of each property in the collection.
Object^ myProperty;
while ( ie->MoveNext() == true )
{
myProperty = ie->Current;
textBox1->Text = textBox1->Text + myProperty + "\n";
}
}
private void MyEnumerator()
{
// Creates a new collection and assigns it the properties for button1.
PropertyDescriptorCollection properties =
TypeDescriptor.GetProperties(button1);
// Creates an enumerator.
IEnumerator ie = properties.GetEnumerator();
// Prints the name of each property in the collection.
Object myProperty;
while ((ie.MoveNext() == true)) {
myProperty = ie.get_Current();
textBox1.set_Text(myProperty.ToString() + '\n');
}
} //MyEnumerator
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
IEnumerator