NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

EventDescriptorCollection.GetEnumerator

Gets an enumerator for this EventDescriptorCollection.

[Visual Basic]
Public Function GetEnumerator() As IEnumerator
[C#]
public IEnumerator GetEnumerator();
[C++]
public: IEnumerator* GetEnumerator();
[JScript]
public function GetEnumerator() : IEnumerator;

Return Value

An enumerator of type IEnumerator.

Example [Visual Basic]

The following example gets an enumerator for the events on Button1. It uses the enumerator to print the names of the events in the collection. It assumes that Button1 has been instantiated on a form.

[Visual Basic]

Private Sub MyEnumerator()
   Dim events As EventDescriptorCollection
   events = TypeDescriptor.GetEvents(Button1)

   ' Create an enumerator
   Dim ie As IEnumerator
   ie = events.GetEnumerator

   ' Print the name of each Event in the collecction.
   Dim myEvent As Object
   Do While ie.MoveNext = True
      myEvent = ie.Current
      TextBox1.Text &= " " & myEvent.ToString
   Loop
End Sub

See Also

EventDescriptorCollection Class | EventDescriptorCollection Members | System.ComponentModel Namespace | EventDescriptor | TypeDescriptor | IEnumerator