Hello Everyone,
Is there anything wrong with this block of code?
ArrayList arr = new ArrayList( 33 );
for( int i = 0; i < 33; ++i )
{
arr.Insert( i, new MyObject() );
}
It's so strange that when my web application have another thread allocating
and deallocating bit junks of memory at the same time, I occasionally got
ArgumentOutOfRangeException from the the insert method. And the states of
the variables at the exception are:
i = 31
arr.Count = 4 // this is strange, shouldn't it be 31?
If I use arr.Add method instead, it works better. Has anyone seen something
like this before or something I misunderstood about ArrayList::Insert()
method? Thanks!
-zeng