EventDescriptorCollection.GetEnumerator メソッド
アセンブリ: System (system.dll 内)

Dim instance As EventDescriptorCollection Dim returnValue As IEnumerator returnValue = instance.GetEnumerator
public IEnumerator GetEnumerator ()
public: IEnumerator^ GetEnumerator ()
public IEnumerator GetEnumerator ()
public function GetEnumerator () : IEnumerator
IEnumerator を実装している列挙子。

![]() |
---|
このクラスに適用される HostProtectionAttribute 属性の Resources プロパティの値は、Synchronization です。HostProtectionAttribute は、デスクトップ アプリケーション (一般的には、アイコンをダブルクリック、コマンドを入力、またはブラウザに URL を入力して起動するアプリケーション) には影響しません。詳細については、HostProtectionAttribute クラスのトピックまたは「SQL Server プログラミングとホスト保護属性」を参照してください。 |

button1 のイベントの列挙子を取得するコード例を次に示します。この例では、列挙子を使用してコレクション内のイベントの名前を出力します。この例では、button1 と textBox1 がフォーム上でインスタンス化されていることが必要です。
Private Sub MyEnumerator() ' Creates a new collection, and assigns to it the events for button1. Dim events As EventDescriptorCollection = TypeDescriptor.GetEvents(button1) ' Creates an enumerator. Dim ie As IEnumerator = events.GetEnumerator() ' Prints the name of each event in the collection. Dim myEvent As Object While ie.MoveNext() = True myEvent = ie.Current textBox1.Text += myEvent.ToString() & ControlChars.Cr End While End Sub 'MyEnumerator
private void MyEnumerator() { // Creates a new collection, and assigns to it the events for button1. EventDescriptorCollection events = TypeDescriptor.GetEvents(button1); // Creates an enumerator. IEnumerator ie = events.GetEnumerator(); // Prints the name of each event in the collection. Object myEvent; while(ie.MoveNext() == true) { myEvent = ie.Current; textBox1.Text += myEvent.ToString() + '\n'; } }
private: void MyEnumerator() { // Creates a new collection, and assigns to it the events for button1. EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); // Creates an enumerator. IEnumerator^ ie = events->GetEnumerator(); // Prints the name of each event in the collection. Object^ myEvent; while ( ie->MoveNext() == true ) { myEvent = ie->Current; textBox1->Text = String::Concat( textBox1->Text, myEvent, "\n" ); } }
private void MyEnumerator() { // Creates a new collection, and assigns to it the events for button1. EventDescriptorCollection events = TypeDescriptor.GetEvents(button1); // Creates an enumerator. IEnumerator myEnumerator = events.GetEnumerator(); // Prints the name of each event in the collection. Object myEvent; while (myEnumerator.MoveNext() == true) { myEvent = myEnumerator.get_Current(); textBox1.set_Text(textBox1.get_Text() + myEvent.ToString() + '\n'); } } //MyEnumerator

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- EventDescriptorCollection.GetEnumerator メソッドのページへのリンク