ArrayList 
Author Message
 ArrayList

Hello all:

I have been trying to get access to individual items in an
array list that I have created but when I use
arrayList.Item(index) the compiler tells me that ArrayList
does not have a definition for Item but in the member list
it is clearly shown as a member of the ArrayList type.

Is there any way to get access to individual items in the
collection without using the foreach structure?

Thanks,

John



Mon, 23 May 2005 01:49:02 GMT  
 ArrayList
John,

    The Item property in C# is the indexer for the arraylist.  In order to
use it, you want to use this syntax:

// Get the item at index.
object pobjObject = arrayList[index];

    Hope this helps.

--
               - Nicholas Paldino [.NET/C# MVP]


Quote:
> Hello all:

> I have been trying to get access to individual items in an
> array list that I have created but when I use
> arrayList.Item(index) the compiler tells me that ArrayList
> does not have a definition for Item but in the member list
> it is clearly shown as a member of the ArrayList type.

> Is there any way to get access to individual items in the
> collection without using the foreach structure?

> Thanks,

> John



Mon, 23 May 2005 01:59:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How can i have a arraylist that has items as arraylist

2. ArrayList in an ArrayList

3. ArrayList with dynamic size

4. Problem using IndexOf() with an ArrayList of custom objects

5. Enumerating through and modifying an ArrayList

6. Convert ArrayList to string array

7. Remove duplicated items in an ArrayList

8. Converting from ArrayList pointer to ComboBox pointer

9. How to pass ArrayList through Web Service

10. ArrayList Object References

11. Q: getting values from inside ArrayList

12. Need help with ArrayList casting?

 

 
Powered by phpBB® Forum Software