CollectionChangeEventHandler 委托

定义

表示处理将元素添加到集合中或从集合中移除元素时引发的 CollectionChanged 事件的方法。Represents the method that handles the CollectionChanged event raised when adding elements to or removing elements from a collection.

public delegate void CollectionChangeEventHandler(System::Object ^ sender, CollectionChangeEventArgs ^ e);
public delegate void CollectionChangeEventHandler(object sender, CollectionChangeEventArgs e);
type CollectionChangeEventHandler = delegate of obj * CollectionChangeEventArgs -> unit
Public Delegate Sub CollectionChangeEventHandler(sender As Object, e As CollectionChangeEventArgs)

参数

sender
Object

事件源。The source of the event.

e
CollectionChangeEventArgs

包含事件数据的 CollectionChangeEventArgsA CollectionChangeEventArgs that contains the event data.

继承
CollectionChangeEventHandler

示例

有关使用 CollectionChangeEventHandler 委托的示例,请参阅 DataColumnCollection 类的 CollectionChanged 事件中的示例代码。For an example of using the CollectionChangeEventHandler delegate, see the sample code in the CollectionChanged event of the DataColumnCollection class.

注解

创建 CollectionChangeEventHandler 委托时,需要标识将处理该事件的方法。When you create a CollectionChangeEventHandler delegate, you identify the method that will handle the event. 若要将事件与事件处理程序关联,请将该委托的一个实例添加到事件中。To associate the event with your event handler, add an instance of the delegate to the event. 除非移除了该委托,否则每当发生该事件时就会调用事件处理程序。The event handler is called whenever the event occurs, unless you remove the delegate. 有关事件处理程序委托的详细信息,请参阅处理和引发事件For more information about event handler delegates, see Handling and Raising Events.

扩展方法

GetMethodInfo(Delegate)

获取指示指定委托表示的方法的对象。Gets an object that represents the method represented by the specified delegate.

适用于

另请参阅