Solved

Accessing items in ArrayList of ArrayLists

Posted on 2006-11-29
1
771 Views
Last Modified: 2008-02-01
Hi

I have an ArrayList (al) and I add Arraylists to it.
Is there a simple way to get the first item of the first arraylist?
Or the sixth item of the first arraylist?
thanks
HMC
0
Comment
Question by:hmcgeehan
1 Comment
 
LVL 2

Accepted Solution

by:
BogdyPtr earned 20 total points
ID: 18035784
Try ((ArrayList)al[0])[0] to get first element of the first ArrayList.
A more elegant solution is to use generic List class instead of the main array list:

List<ArrayList> arrays;

...

arrays[1][2] = 5;
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question