EventDescriptorCollection クラス

定義

EventDescriptor オブジェクトのコレクションを表します。

public ref class EventDescriptorCollection : System::Collections::IList
public class EventDescriptorCollection : System.Collections.IList
[System.Runtime.InteropServices.ComVisible(true)]
public class EventDescriptorCollection : System.Collections.IList
type EventDescriptorCollection = class
    interface ICollection
    interface IEnumerable
    interface IList
[<System.Runtime.InteropServices.ComVisible(true)>]
type EventDescriptorCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
[<System.Runtime.InteropServices.ComVisible(true)>]
type EventDescriptorCollection = class
    interface ICollection
    interface IEnumerable
    interface IList
Public Class EventDescriptorCollection
Implements IList
継承
EventDescriptorCollection
属性
実装

次のコード例では、テキスト ボックス内のボタンにすべてのイベントを出力します。 フォームで と textBox1button1インスタンス化されている必要があります。

private:
   void MyEventCollection()
   {
      // Creates a new collection and assigns it the events for button1.
      EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 );
      
      // Displays each event in the collection in a text box.
      for each ( EventDescriptor^ myEvent in events )
      {
         textBox1->Text = String::Concat( textBox1->Text, myEvent->Name, "\n" );
      }
   }
private void MyEventCollection() {
    // Creates a new collection and assigns it the events for button1.
    EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);
 
    // Displays each event in the collection in a text box.
    foreach (EventDescriptor myEvent in events)
       textBox1.Text += myEvent.Name + '\n';
 }
Private Sub MyEventCollection()
    ' Creates a new collection and assigns it the events for button1.
    Dim events As EventDescriptorCollection = TypeDescriptor.GetEvents(button1)
    
    ' Displays each event in the collection in a text box.
    Dim myEvent As EventDescriptor
    For Each myEvent In  events
        textBox1.Text &= myEvent.Name & ControlChars.Cr
    Next myEvent
End Sub

注釈

EventDescriptorCollection は読み取り専用です。イベントを追加または削除するメソッドは実装されません。 これらのメソッドを実装するには、このクラスから継承する必要があります。

クラスで使用できるプロパティを EventDescriptorCollection 使用すると、コレクションの内容に関するクエリを実行できます。 コレクション内の要素の数を確認するには、Count プロパティを使用します。 Item[]インデックス番号または名前で特定のプロパティを取得するには、 プロパティを使用します。

メソッドを Find 使用して、指定した名前のイベントの説明をコレクションから取得することもできます。

コンストラクター

EventDescriptorCollection(EventDescriptor[])

EventDescriptorCollection オブジェクトの配列を指定して、EventDescriptor クラスの新しいインスタンスを初期化します。

EventDescriptorCollection(EventDescriptor[], Boolean)

EventDescriptorCollection オブジェクトの配列を指定して、EventDescriptor クラスの新しいインスタンスを初期化します。 このコレクションは、オプションで読み取り専用にできます。

フィールド

Empty

項目が格納されていないコレクションを新規作成するのではなく、空のコレクションを使用することを指定します。 static フィールドは読み取り専用です。

プロパティ

Count

コレクション内のイベント記述子の数を取得します。

Item[Int32]

指定したインデックス番号のイベントを取得または設定します。

Item[String]

指定した名前を持つイベントを取得または設定します。

メソッド

Add(EventDescriptor)

コレクションの末尾に EventDescriptor を追加します。

Clear()

コレクションからすべてのオブジェクトを削除します。

Contains(EventDescriptor)

指定した EventDescriptor がコレクションに格納されているかどうかを示す値を返します。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
Find(String, Boolean)

コレクション内の指定した名前を持つイベントの説明を取得します。

GetEnumerator()

この EventDescriptorCollection の列挙子を取得します

GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IndexOf(EventDescriptor)

指定した EventDescriptor のインデックスを返します。

Insert(Int32, EventDescriptor)

コレクション内の指定したインデックス位置に EventDescriptor を挿入します。

InternalSort(IComparer)

指定した EventDescriptorCollection を使用して、IComparer のメンバーを並べ替えます。

InternalSort(String[])

EventDescriptorCollection のメンバーを並べ替えます。 指定した順序が最初に適用され、次にコレクションの既定の並べ替え順序が適用されます。既定の並べ替え順序は、通常はアルファベット順です。

MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
Remove(EventDescriptor)

指定された EventDescriptor をコレクションから削除します。

RemoveAt(Int32)

指定したインデックス位置にある EventDescriptor をコレクションから削除します。

Sort()

コレクションの既定の並べ替え順序を使用して、EventDescriptorCollection のメンバーを並べ替えます。既定の並べ替え順序は、通常はアルファベット順です。

Sort(IComparer)

指定した EventDescriptorCollection を使用して、IComparer のメンバーを並べ替えます。

Sort(String[])

指定した並べ替え順序で、EventDescriptorCollection のメンバーを並べ替えます。

Sort(String[], IComparer)

指定した並べ替え順序と EventDescriptorCollection を使用して、IComparer のメンバーを並べ替えます。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

ICollection.CopyTo(Array, Int32)

コレクションの要素を Array にコピーします。Array の特定のインデックスからコピーが開始されます。

ICollection.Count

コレクションに格納されている要素の数を取得します。

ICollection.IsSynchronized

コレクションへのアクセスが同期されるかどうかを示す値を取得します。

ICollection.SyncRoot

コレクションへのアクセスを同期するために使用できるオブジェクトを取得します。

IEnumerable.GetEnumerator()

コレクションを反復処理する列挙子を返します。

IList.Add(Object)

項目をコレクションに追加します。

IList.Clear()

コレクションからすべての項目を削除します。

IList.Contains(Object)

コレクションに特定の値が格納されているかどうかを判断します。

IList.IndexOf(Object)

コレクション内での指定した項目のインデックスを調べます。

IList.Insert(Int32, Object)

アイテムをコレクション内の指定したインデックスに挿入します。

IList.IsFixedSize

コレクションが固定サイズかどうかを示す値を取得します。

IList.IsReadOnly

コレクションが読み取り専用かどうかを示す値を取得します。

IList.Item[Int32]

指定したインデックスにある要素を取得または設定します。

IList.Remove(Object)

特定のオブジェクトの最初に出現したものをコレクションから削除します。

IList.RemoveAt(Int32)

指定したインデックス位置にある項目を削除します。

拡張メソッド

Cast<TResult>(IEnumerable)

IEnumerable の要素を、指定した型にキャストします。

OfType<TResult>(IEnumerable)

指定された型に基づいて IEnumerable の要素をフィルター処理します。

AsParallel(IEnumerable)

クエリの並列化を有効にします。

AsQueryable(IEnumerable)

IEnumerableIQueryable に変換します。

適用対象

こちらもご覧ください