CollectionBase.OnSetComplete 方法

当在 CollectionBase 实例中设置值后执行其他自定义进程。

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

语法

声明
Protected Overridable Sub OnSetComplete ( _
    index As Integer, _
    oldValue As Object, _
    newValue As Object _
)
用法
Dim index As Integer
Dim oldValue As Object
Dim newValue As Object

Me.OnSetComplete(index, oldValue, newValue)
protected virtual void OnSetComplete (
    int index,
    Object oldValue,
    Object newValue
)
protected:
virtual void OnSetComplete (
    int index, 
    Object^ oldValue, 
    Object^ newValue
)
protected void OnSetComplete (
    int index, 
    Object oldValue, 
    Object newValue
)
protected function OnSetComplete (
    index : int, 
    oldValue : Object, 
    newValue : Object
)

参数

  • index
    从零开始的索引,可在该位置找到 oldValue。
  • oldValue
    要用 newValue 替换的值。
  • newValue
    index 处的元素的新值。

备注

此方法的默认实现需要由派生类重写,以便在设置指定元素之后执行某些操作。

仅对 List 属性所返回的实例调用 On* 方法,而不对 InnerList 属性所返回的实例调用这些方法。

如果出现以下任意一种情况,集合则恢复到其以前的状态:

  • 进程失败。

  • 重写此方法以引发异常。

此方法的默认实现的运算复杂度为 O(1)。

给实现者的说明 此方法允许实施者定义在设置基础 System.Collections.ArrayList 中的指定元素之后必须执行的进程。通过定义此方法,实施者可以向继承方法添加功能,而无须重写所有其他方法。 在标准的设置行为之前调用 OnSet,而在标准的设置行为之后调用 OnSetComplete

平台

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

请参见

参考

CollectionBase 类
CollectionBase 成员
System.Collections 命名空间
OnSet
OnInsertComplete