Are you positive? I looked at the IL for the CollectionBase::RemoveAt and
the two statements do exist in the method call. Look below:
..method public hidebysig newslot virtual final
instance void RemoveAt(int32 index) cil managed
{
// Code size 83 (0x53)
.maxstack 3
.locals (object V_0)
IL_0000: ldarg.1
IL_0001: ldc.i4.0
IL_0002: blt.s IL_0012
IL_0004: ldarg.1
IL_0005: ldarg.0
IL_0006: call instance class System.Collections.ArrayList
System.Collections.CollectionBase::get_InnerList()
IL_000b: callvirt instance int32
System.Collections.ArrayList::get_Count()
IL_0010: blt.s IL_0022
IL_0012: ldstr "ArgumentOutOfRange_Index"
IL_0017: call string System.Environment::GetResourceString(string)
IL_001c: newobj instance void
System.ArgumentOutOfRangeException::.ctor(string)
IL_0021: throw
IL_0022: ldarg.0
IL_0023: call instance class System.Collections.ArrayList
System.Collections.CollectionBase::get_InnerList()
IL_0028: ldarg.1
IL_0029: callvirt instance object
System.Collections.ArrayList::get_Item(int32)
IL_002e: stloc.0
IL_002f: ldarg.0
IL_0030: ldloc.0
IL_0031: callvirt instance void
System.Collections.CollectionBase::OnValidate(obje ct)
IL_0036: ldarg.0
IL_0037: ldarg.1
IL_0038: ldloc.0
IL_0039: callvirt instance void
System.Collections.CollectionBase::OnRemove(int32,
object)
IL_003e: ldarg.0
IL_003f: call instance class System.Collections.ArrayList
System.Collections.CollectionBase::get_InnerList()
IL_0044: ldarg.1
IL_0045: callvirt instance void
System.Collections.ArrayList::RemoveAt(int32)
IL_004a: ldarg.0
IL_004b: ldarg.1
IL_004c: ldloc.0
IL_004d: callvirt instance void
System.Collections.CollectionBase::OnRemoveComplet e(int32,
object)
IL_0052: ret
} // end of method CollectionBase::RemoveAt
"m. pollack" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
Hi all,
I've been using the CollectionBase class to implement a
strongly-typed collection, but I have noticed that the
RemoveAt method does not seem to call the "On" hook
methods (OnRemove, OnRemoveComplete). The Add method works
fine, though! I need these to work -- I am exposing the
collection to the user through a PropertyGrid control, and
the user can add/remove collection elements with the
(apparently undocumented) Object Collection Editor that
the PropertyGrid invokes, and I need to do some work when
that happens...
Is this a bug? I saw a reference to the problem here:
http://lists.ximian.com/archives/public/mono-list/2001-
November/001978.html
Any thoughts?
Thanks, MP