Andrew,
Well, you are adding the objects twice. The first time is in the
constructor, where you pass bunchOfStuff, the second is when you call
AddRange, passing the array again, resulting in four items.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"andrewcw" <an******@acw.com> wrote in message
news:05**********************************@microsof t.com...
Who can explain this ?? : I expect 2 but I get 4 items !
private void button1_Click(object sender, EventArgs e)
{
object[] bunchOfStuff = { "foo", "fee" };
listBox1.Items.Clear();
System.Windows.Forms.ListBox.ObjectCollection lboxObjCol = new
ListBox.ObjectCollection(listBox1, bunchOfStuff);
listBox1.Items.AddRange(lboxObjCol);
}
--
Andrew