EventDescriptorCollection クラス
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
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
- 属性
- 実装
次のコード例では、テキスト ボックス内のボタンにすべてのイベントを出力します。 フォームで と textBox1
がbutton1
インスタンス化されている必要があります。
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 使用して、指定した名前のイベントの説明をコレクションから取得することもできます。
Event |
EventDescriptorCollection オブジェクトの配列を指定して、EventDescriptor クラスの新しいインスタンスを初期化します。 |
Event |
EventDescriptorCollection オブジェクトの配列を指定して、EventDescriptor クラスの新しいインスタンスを初期化します。 このコレクションは、オプションで読み取り専用にできます。 |
Empty |
項目が格納されていないコレクションを新規作成するのではなく、空のコレクションを使用することを指定します。
|
Count |
コレクション内のイベント記述子の数を取得します。 |
Item[Int32] |
指定したインデックス番号のイベントを取得または設定します。 |
Item[String] |
指定した名前を持つイベントを取得または設定します。 |
ICollection. |
|
ICollection. |
コレクションに格納されている要素の数を取得します。 |
ICollection. |
コレクションへのアクセスが同期されるかどうかを示す値を取得します。 |
ICollection. |
コレクションへのアクセスを同期するために使用できるオブジェクトを取得します。 |
IEnumerable. |
コレクションを反復処理する列挙子を返します。 |
IList. |
項目をコレクションに追加します。 |
IList. |
コレクションからすべての項目を削除します。 |
IList. |
コレクションに特定の値が格納されているかどうかを判断します。 |
IList. |
コレクション内での指定した項目のインデックスを調べます。 |
IList. |
アイテムをコレクション内の指定したインデックスに挿入します。 |
IList. |
コレクションが固定サイズかどうかを示す値を取得します。 |
IList. |
コレクションが読み取り専用かどうかを示す値を取得します。 |
IList. |
指定したインデックスにある要素を取得または設定します。 |
IList. |
特定のオブジェクトの最初に出現したものをコレクションから削除します。 |
IList. |
指定したインデックス位置にある項目を削除します。 |
Cast<TResult>(IEnumerable) |
IEnumerable の要素を、指定した型にキャストします。 |
Of |
指定された型に基づいて IEnumerable の要素をフィルター処理します。 |
As |
クエリの並列化を有効にします。 |
As |
IEnumerable を IQueryable に変換します。 |
製品 | バージョン |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。