473,473 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

array in a arraylist

how can i acess the members of an array that i put into a arraylist, like
this:

int[] dez = new int[5];
ArrayList arList = new ArrayList();
arList.add(dez);

I want to get the dez[3] value.
[]s...


Nov 16 '05 #1
4 1754
Hi

Use Jagged Arrays . Jagged arrrays are nothing but arrays of arrays.

Ravikanth[MVP]
"Ricardo" wrote:
how can i acess the members of an array that i put into a arraylist, like
this:

int[] dez = new int[5];
ArrayList arList = new ArrayList();
arList.add(dez);

I want to get the dez[3] value.
[]s...


Nov 16 '05 #2
Yes, but i don´t know how many arrays i will need to use, and a jagged array
i must initialize with a static lenght.

"Ravikanth[MVP]" <Ravikanth[MVP]@discussions.microsoft.com> wrote in message
news:12**********************************@microsof t.com...
Hi

Use Jagged Arrays . Jagged arrrays are nothing but arrays of arrays.

Ravikanth[MVP]
"Ricardo" wrote:
how can i acess the members of an array that i put into a arraylist, like this:

int[] dez = new int[5];
ArrayList arList = new ArrayList();
arList.add(dez);

I want to get the dez[3] value.
[]s...


Nov 16 '05 #3
I think what he ment was something like

int[] dez = new int[5];
ArrayList arList = new ArrayList();
arList.add(dez);

--> arList[0][3] <--

"Ricardo" <dr*******@terra.com.br> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
Yes, but i don´t know how many arrays i will need to use, and a jagged array i must initialize with a static lenght.

"Ravikanth[MVP]" <Ravikanth[MVP]@discussions.microsoft.com> wrote in message news:12**********************************@microsof t.com...
Hi

Use Jagged Arrays . Jagged arrrays are nothing but arrays of arrays.

Ravikanth[MVP]
"Ricardo" wrote:
how can i acess the members of an array that i put into a arraylist, like this:

int[] dez = new int[5];
ArrayList arList = new ArrayList();
arList.add(dez);

I want to get the dez[3] value.
[]s...



Nov 16 '05 #4
ArrayLists store objects. You just have to cast the arraylist member object
as an int array:

ArrayList al = new ArrayList();

int[] ar = new int[] {1, 3, 5, 7,9};

al.Add(ar);

Console.WriteLine("ar[2] = {0}", ((int[])al[0])[2]);

I don't know if that's the only or the easiest way to do it, but the concept
remains the same. Cast the object as an integer array.

Dale

"Ricardo" <dr*******@terra.com.br> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
Yes, but i don´t know how many arrays i will need to use, and a jagged array i must initialize with a static lenght.

"Ravikanth[MVP]" <Ravikanth[MVP]@discussions.microsoft.com> wrote in message news:12**********************************@microsof t.com...
Hi

Use Jagged Arrays . Jagged arrrays are nothing but arrays of arrays.

Ravikanth[MVP]
"Ricardo" wrote:
how can i acess the members of an array that i put into a arraylist, like this:

int[] dez = new int[5];
ArrayList arList = new ArrayList();
arList.add(dez);

I want to get the dez[3] value.
[]s...



Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: davehunt | last post by:
Hi folks, New C# programmer here. I am reading some CSV data from a file into an ArrayList. I want to get the data from the ArrayList into a 2-dimensional array. I see a few references to...
13
by: Hrvoje Voda | last post by:
How to put a specified dataset table into an array list ? Hrcko
9
by: Steve | last post by:
Hello, I created a structure ABC and an array of type ABC Public Structure ABC Dim str1 As String Dim int1 As Integer End Structure Public ABC1 As New ABC, ABC2 As New ABC
4
by: Peter | last post by:
I run into this situation all the time and I'm wondering what is the most efficient way to handle this issue: I'll be pulling data out of a data source and want to load the data into an array so...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
18
by: Sam | last post by:
Hi All I'm planing to write an application which allows users dynamically add their points (say you can add upto 30,000) and then draw xy graph. Should I use an array for my coordinate point...
24
by: RyanTaylor | last post by:
I have a final coming up later this week in my beginning Java class and my prof has decided to give us possible Javascript code we may have to write. Problem is, we didn't really cover JS and what...
5
by: Paulers | last post by:
Hello all, I have a string array with duplicate elements. I need to create a new string array containing only the unique elements. Is there an easy way to do this? I have tried looping through...
12
by: Maxwell2006 | last post by:
Hi, I declared an array like this: string scriptArgs = new string; Can I resize the array later in the code? Thank you, Max
9
by: Brian Tkatch | last post by:
I'm looking for a simple way to unique an array of strings. I came up with this. Does it make sense? Am i missing anything? (Testing seems to show it to work.) Public Function Unique(ByVal...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.