Hi,
I'm encountering a very simple issue with ArrayList constructor
and AddRange() method overriding.
I'm defining a class that extends ArrayList and contains one
overriden method: AddRange(ICollection).
public class Test:ArrayList
{
public Test(Array array): base(array)
{
}
public override void AddRange(ICollection c)
{
}
}
If I create an instance of Test:
Test t = new Test(new int[]{1,2,3});
I get
t.Count = 0 instead of t.Count = 3 (what I was naively expecting)
It looks like the ArrayList(ICollection) constructor invoke the
virtual method AddRange().
1/ I was wondering if this is the desired behavior ?
-- and if yes, do you have a pointer for the coding rules of
constructors versus virtual method calls usage ?
2 / Should'nt this specified in the ArrayList documentation ?
Thanks in advance for your help.
Sylvain
--
POST BY: http://www.dotNET.us - Need .NET? Just ask, Please dotNET.us