CollectionChangeEventHandler 委托

表示处理将元素添加到集合中或从集合中移除元素时引发的 CollectionChanged 事件的方法。

**命名空间:**System.ComponentModel
**程序集:**System(在 system.dll 中)

语法

声明
Public Delegate Sub CollectionChangeEventHandler ( _
    sender As Object, _
    e As CollectionChangeEventArgs _
)
用法
Dim instance As New CollectionChangeEventHandler(AddressOf HandlerMethod)
public delegate void CollectionChangeEventHandler (
    Object sender,
    CollectionChangeEventArgs e
)
public delegate void CollectionChangeEventHandler (
    Object^ sender, 
    CollectionChangeEventArgs^ e
)
/** @delegate */
public delegate void CollectionChangeEventHandler (
    Object sender, 
    CollectionChangeEventArgs e
)
JScript 支持使用委托,但不支持进行新的声明。

参数

  • sender
    事件源。

备注

当创建 CollectionChangeEventHandler 委托时,将标识处理事件的方法。若要使该事件与事件处理程序相关联,请将该委托的一个实例添加到事件中。除非移除了该委托,否则每当发生该事件时就调用事件处理程序。有关事件处理程序委托的更多信息,请参见 事件和委托

提示

应用于此类的 HostProtectionAttribute 属性 (Attribute) 具有以下 Resources 属性 (Property) 值:SharedStateHostProtectionAttribute 不影响桌面应用程序(这些应用程序通常通过双击图标、键入命令或在浏览器中输入 URL 来启动)。有关更多信息,请参见 HostProtectionAttribute 类或 SQL Server 编程和宿主保护属性

示例

有关如何使用 CollectionChangeEventHandler 委托的示例,请参见 DataColumnCollection 类的 CollectionChanged 事件中的示例代码。

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

System.ComponentModel 命名空间
CollectionChangeEventArgs 类
CollectionChangeAction 枚举