Solved

Accessing items in ArrayList of ArrayLists

Posted on 2006-11-29
1
772 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

820 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