TypeDescriptor.GetEvents 方法

定義

傳回元件或類型之事件的集合。

多載

GetEvents(Object)

傳回指定元件的事件集合。

GetEvents(Type)

傳回指定元件類型的事件集合。

GetEvents(Object, Attribute[])

使用指定的屬性陣列做為篩選條件,傳回指定元件的事件集合。

GetEvents(Object, Boolean)

傳回具有自訂類型描述元之指定元件的事件集合。

GetEvents(Type, Attribute[])

使用指定的屬性陣列做為篩選條件,傳回指定元件類型的事件集合。

GetEvents(Object, Attribute[], Boolean)

使用指定的屬性陣列做為篩選條件並使用自訂類型描述元,傳回指定元件的事件集合。

GetEvents(Object)

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

傳回指定元件的事件集合。

public:
 static System::ComponentModel::EventDescriptorCollection ^ GetEvents(System::Object ^ component);
public static System.ComponentModel.EventDescriptorCollection GetEvents (object component);
static member GetEvents : obj -> System.ComponentModel.EventDescriptorCollection
Public Shared Function GetEvents (component As Object) As EventDescriptorCollection

參數

component
Object

要取得

傳回

內含這個元件之事件的 EventDescriptorCollection

例外狀況

component 是跨處理序的遠端物件。

範例

如需此方法的範例,請參閱 Count 屬性。

備註

擷取指定 component 參數實例所提供的事件集合。 這個集合可能與類別所提供的事件集不同。 component如果參數已月臺,月臺可以新增或移除其他事件。

如果 為 componentnull,則會傳回空集合。

傳回集合的順序不保證在呼叫之間相同,因此一律先排序它再使用。

另請參閱

適用於

GetEvents(Type)

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

傳回指定元件類型的事件集合。

public:
 static System::ComponentModel::EventDescriptorCollection ^ GetEvents(Type ^ componentType);
public static System.ComponentModel.EventDescriptorCollection GetEvents (Type componentType);
static member GetEvents : Type -> System.ComponentModel.EventDescriptorCollection
Public Shared Function GetEvents (componentType As Type) As EventDescriptorCollection

參數

componentType
Type

目標元件的 Type

傳回

內含這個元件之事件的 EventDescriptorCollection

備註

只有在您沒有 對象的實例時,才呼叫這個版本的這個方法。

componentType如果 參數為 null,則會傳回空集合。

傳回集合的順序不保證在呼叫之間相同,因此一律先排序它再使用。

另請參閱

適用於

GetEvents(Object, Attribute[])

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

使用指定的屬性陣列做為篩選條件,傳回指定元件的事件集合。

public:
 static System::ComponentModel::EventDescriptorCollection ^ GetEvents(System::Object ^ component, cli::array <Attribute ^> ^ attributes);
public static System.ComponentModel.EventDescriptorCollection GetEvents (object component, Attribute[] attributes);
static member GetEvents : obj * Attribute[] -> System.ComponentModel.EventDescriptorCollection
Public Shared Function GetEvents (component As Object, attributes As Attribute()) As EventDescriptorCollection

參數

component
Object

要取得

attributes
Attribute[]

Attribute 類型陣列,可供您做為篩選條件。

傳回

具有符合此元件指定屬性之事件的 EventDescriptorCollection

例外狀況

component 是跨處理序的遠端物件。

備註

參數的事件 component 可能與類別的事件不同,因為如果 component 參數已月臺,月臺可以新增或移除事件。

attributes數位可以混合和 TypeAttribute 物件。 篩選是由下列規則所定義:

  • Type會被視為通配符;它會比對在其屬性集中具有 Type 的任何事件。

  • 如果事件沒有 Attribute 相同類別的 ,則事件不會包含在傳回的陣列中。

  • 如果屬性是 類別的 Attribute 實例,則事件必須是完全相符的,或未包含在傳回的數位中。

  • 如果指定 Attribute 實例,而且它是預設事件,即使事件中沒有的實例 Attribute ,也會包含在傳回的陣列中。

如果 為 componentnull,則會傳回空集合。

傳回集合的順序不保證在呼叫之間相同,因此一律先排序它再使用。

另請參閱

適用於

GetEvents(Object, Boolean)

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

傳回具有自訂類型描述元之指定元件的事件集合。

public:
 static System::ComponentModel::EventDescriptorCollection ^ GetEvents(System::Object ^ component, bool noCustomTypeDesc);
public static System.ComponentModel.EventDescriptorCollection GetEvents (object component, bool noCustomTypeDesc);
static member GetEvents : obj * bool -> System.ComponentModel.EventDescriptorCollection
Public Shared Function GetEvents (component As Object, noCustomTypeDesc As Boolean) As EventDescriptorCollection

參數

component
Object

要取得

noCustomTypeDesc
Boolean

true 表示不考慮自訂類型描述資訊,否則為 false

傳回

內含這個元件之事件的 EventDescriptorCollection

例外狀況

component 是跨處理序的遠端物件。

備註

這個方法會擷取指定 component 參數實例所提供的事件集合。 這與類別所提供的事件集不同。 component如果參數已月臺,月臺可以新增或移除其他事件。

如果 為 componentnull,則會傳回空集合。

傳回集合的順序不保證在呼叫之間相同,因此一律先排序它再使用。

另請參閱

適用於

GetEvents(Type, Attribute[])

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

使用指定的屬性陣列做為篩選條件,傳回指定元件類型的事件集合。

public:
 static System::ComponentModel::EventDescriptorCollection ^ GetEvents(Type ^ componentType, cli::array <Attribute ^> ^ attributes);
public static System.ComponentModel.EventDescriptorCollection GetEvents (Type componentType, Attribute[] attributes);
static member GetEvents : Type * Attribute[] -> System.ComponentModel.EventDescriptorCollection
Public Shared Function GetEvents (componentType As Type, attributes As Attribute()) As EventDescriptorCollection

參數

componentType
Type

目標元件的 Type

attributes
Attribute[]

Attribute 類型陣列,可供您做為篩選條件。

傳回

具有符合此元件指定屬性之事件的 EventDescriptorCollection

備註

只有在您沒有 對象的實例時,才呼叫這個版本的這個方法。

參數 attributes 數位可以混合 TypeAttribute 物件。 篩選是由下列規則所定義:

  • Type會被視為通配符;它會比對在其屬性集中具有 Type 的任何事件。

  • 如果事件沒有 Attribute 相同類別的 ,則事件不會包含在傳回的陣列中。

  • 如果屬性是 類別的 Attribute 實例,則事件必須是完全相符的,或未包含在傳回的數位中。

  • 如果指定 Attribute 實例,而且它是預設事件,即使事件中沒有的實例 Attribute ,也會包含在傳回的陣列中。

componentType如果 參數為 null,則會傳回空集合。

傳回集合的順序不保證在呼叫之間相同,因此一律先排序它再使用。

另請參閱

適用於

GetEvents(Object, Attribute[], Boolean)

來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs
來源:
TypeDescriptor.cs

使用指定的屬性陣列做為篩選條件並使用自訂類型描述元,傳回指定元件的事件集合。

public:
 static System::ComponentModel::EventDescriptorCollection ^ GetEvents(System::Object ^ component, cli::array <Attribute ^> ^ attributes, bool noCustomTypeDesc);
public static System.ComponentModel.EventDescriptorCollection GetEvents (object component, Attribute[] attributes, bool noCustomTypeDesc);
public static System.ComponentModel.EventDescriptorCollection GetEvents (object component, Attribute[]? attributes, bool noCustomTypeDesc);
static member GetEvents : obj * Attribute[] * bool -> System.ComponentModel.EventDescriptorCollection
Public Shared Function GetEvents (component As Object, attributes As Attribute(), noCustomTypeDesc As Boolean) As EventDescriptorCollection

參數

component
Object

要取得

attributes
Attribute[]

做為篩選條件使用的 Attribute 類型陣列。

noCustomTypeDesc
Boolean

true 表示不考慮自訂類型描述資訊,否則為 false

傳回

具有符合此元件指定屬性之事件的 EventDescriptorCollection

例外狀況

component 是跨處理序的遠端物件。

備註

參數的事件 component 可能與類別的事件不同,因為如果 component 參數已月臺,月臺可以新增或移除事件。

參數 attributes 數位可以混合 TypeAttribute 物件。 篩選是由下列規則所定義:

  • Type會被視為通配符;它會比對在其屬性集中具有 Type 的任何事件。

  • 如果事件沒有 Attribute 相同類別的 ,則事件不會包含在傳回的陣列中。

  • 如果屬性是 類別的 Attribute 實例,則事件必須是完全相符的,或未包含在傳回的數位中。

  • 如果指定 Attribute 實例,而且它是預設事件,即使事件中沒有的實例 Attribute ,也會包含在傳回的陣列中。

如果 為 componentnull,則會傳回空集合。

傳回集合的順序不保證在呼叫之間相同,因此一律先排序它再使用。

另請參閱

適用於