I am trying to populate an ArrayList using the elements from a DataTable. I know I could do this using Loop, but I am trying to figure out how to using AddRange.

Here's my code:

SomeArrayList.AddRange(SomeDataTable.Rows.Item(0).ItemArray)

The problem is that I can pass the collection except for the Zeroth element.

This is the collection I am trying to pass to the ArrayList:
1. Dog
2. Cat
3. Bird

This is what I got
1. Cat
2. Bird

Hi,

You can use the AddRange method to do so.
For more explanation, look here.

Hi,

You can use the AddRange method to do so.
For more explanation, look here.

Hi,

I've already used the AddRange, and it works(barely). My Question still stands: Why does the Index 0 of the collection SomeDataTable.Rows.Item(0).ItemArray is not present in the SomeArrayList.

Hi,

I think you'll need to use the ArrayList.IndexOf method for that.
Look, here.