Szerkesztés

Megosztás a következőn keresztül:


TypeDescriptor.GetEvents Method

Definition

Returns the collection of events for a component or type.

Overloads

GetEvents(Object)

Returns the collection of events for the specified component.

GetEvents(Type)

Returns the collection of events for a specified type of component.

GetEvents(Object, Attribute[])

Returns the collection of events for a specified component using a specified array of attributes as a filter.

GetEvents(Object, Boolean)

Returns the collection of events for a specified component with a custom type descriptor.

GetEvents(Type, Attribute[])

Returns the collection of events for a specified type of component using a specified array of attributes as a filter.

GetEvents(Object, Attribute[], Boolean)

Returns the collection of events for a specified component using a specified array of attributes as a filter and using a custom type descriptor.

GetEvents(Object)

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

Returns the collection of events for the specified component.

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

Parameters

component
Object

A component to get the events for.

Returns

An EventDescriptorCollection with the events for this component.

Exceptions

component is a cross-process remoted object.

Examples

For an example of this method, see the Count property.

Remarks

Retrieves a collection of events that the given component parameter instance provides. This collection can differ from the set of events the class provides. If the component parameter is sited, the site can add or remove additional events.

If component is null, then an empty collection is returned.

The order of the returned collection is not guaranteed to be identical between calls, so always order it before use.

See also

Applies to

GetEvents(Type)

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

Returns the collection of events for a specified type of component.

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

Parameters

componentType
Type

The Type of the target component.

Returns

An EventDescriptorCollection with the events for this component.

Remarks

Call this version of this method only when you do not have an instance of the object.

If the componentType parameter is null, an empty collection is returned.

The order of the returned collection is not guaranteed to be identical between calls, so always order it before use.

See also

Applies to

GetEvents(Object, Attribute[])

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

Returns the collection of events for a specified component using a specified array of attributes as a filter.

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

Parameters

component
Object

A component to get the events for.

attributes
Attribute[]

An array of type Attribute that you can use as a filter.

Returns

An EventDescriptorCollection with the events that match the specified attributes for this component.

Exceptions

component is a cross-process remoted object.

Remarks

The events for the component parameter can differ from the events of a class, because the site can add or remove events if the component parameter is sited.

The attributes array can have a mix of Type and Attribute objects. Filtering is defined by the following rules:

  • A Type is treated as a wildcard; it matches any event that has the Type in its set of attributes.

  • If an event does not have an Attribute of the same class, the event is not included in the returned array.

  • If the attribute is an instance of the Attribute class, the event must be an exact match or it is not included in the returned array.

  • If an Attribute instance is specified and it is the default event, it is included in the returned array even if there is no instance of the Attribute in the event.

If component is null, an empty collection is returned.

The order of the returned collection is not guaranteed to be identical between calls, so always order it before use.

See also

Applies to

GetEvents(Object, Boolean)

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

Returns the collection of events for a specified component with a custom type descriptor.

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

Parameters

component
Object

A component to get the events for.

noCustomTypeDesc
Boolean

true to not consider custom type description information; otherwise, false.

Returns

An EventDescriptorCollection with the events for this component.

Exceptions

component is a cross-process remoted object.

Remarks

This method retrieves a collection of events that the given component parameter instance provides. This can differ from the set of events the class provides. If the component parameter is sited, the site can add or remove additional events.

If component is null, an empty collection is returned.

The order of the returned collection is not guaranteed to be identical between calls, so always order it before use.

See also

Applies to

GetEvents(Type, Attribute[])

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

Returns the collection of events for a specified type of component using a specified array of attributes as a filter.

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

Parameters

componentType
Type

The Type of the target component.

attributes
Attribute[]

An array of type Attribute that you can use as a filter.

Returns

An EventDescriptorCollection with the events that match the specified attributes for this component.

Remarks

Call this version of this method only when you do not have an instance of the object.

The attributes parameter array can have a mix of Type and Attribute objects. Filtering is defined by the following rules:

  • A Type is treated as a wildcard; it matches any event that has the Type in its set of attributes.

  • If an event does not have an Attribute of the same class, the event is not included in the returned array.

  • If the attribute is an instance of the Attribute class, the event must be an exact match or it is not included in the returned array.

  • If an Attribute instance is specified and it is the default event, it is included in the returned array even if there is no instance of the Attribute in the event.

If the componentType parameter is null, an empty collection is returned.

The order of the returned collection is not guaranteed to be identical between calls, so always order it before use.

See also

Applies to

GetEvents(Object, Attribute[], Boolean)

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

Returns the collection of events for a specified component using a specified array of attributes as a filter and using a custom type descriptor.

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

Parameters

component
Object

A component to get the events for.

attributes
Attribute[]

An array of type Attribute to use as a filter.

noCustomTypeDesc
Boolean

true to not consider custom type description information; otherwise, false.

Returns

An EventDescriptorCollection with the events that match the specified attributes for this component.

Exceptions

component is a cross-process remoted object.

Remarks

The events for the component parameter can differ from the events of a class, because the site can add or remove events if the component parameter is sited.

The attributes parameter array can have a mix of Type and Attribute objects. Filtering is defined by the following rules:

  • A Type is treated as a wildcard; it matches any event that has the Type in its set of attributes.

  • If an event does not have an Attribute of the same class, the event is not included in the returned array.

  • If the attribute is an instance of the Attribute class, the event must be an exact match or it is not included in the returned array.

  • If an Attribute instance is specified and it is the default event, it is included in the returned array even if there is no instance of the Attribute in the event.

If component is null, an empty collection is returned.

The order of the returned collection is not guaranteed to be identical between calls, so always order it before use.

See also

Applies to