Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 16-02-2009, 09:23 PM   #1 (permalink)
In The Zone
 
Pragadheesh's Avatar
 
Join Date: Jul 2006
Location: Coimbatore
Posts: 403
Default c# doubt in ArrayList


hi everyone,
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;

namespace arraylist
{
    public struct ParameterValues
    {
        public ArrayList al;


    };
    

   public class Program
    {
       public static ArrayList alMix = new 

ArrayList();
       public static ParameterValues pValue = new 

ParameterValues();    
       public static void Main(string[] args)
       { 
           pValue.al = new ArrayList();
            pValue.al.Add(5);
            pValue.al.Add("vgbd");
            pValue.al.Add('d');

            alMix.Add(pValue.al);
            alMix.Add(pValue.al);
//Now i want to ACCESS the elements of alMix array list
           
            Console.ReadKey();
        }
    }
}
in the above program i have created an array list inside the structure and populated it.
The contents gets saved as,
pValue.al[0] = 5
pValue.al[1] = "vgbd"
pValue.al[2] = 'd'

Then i copied those values in another array list alMix where it is getting stored as.
alMix[0][0] = 5
alMix[0][1] = "vgbd"
alMix[0][2] = 'd'
alMix[1][0] = 5
alMix[1][1] = "vgbd"
alMix[1][2] = 'd'

Now since the alMix arraylist is 2D, i'm unable to access it. Please help in accessing the elements of the alMix array list which is 2-dimensional.?

thanx in advance.

no need. i found d solution.

Last edited by Pragadheesh; 17-02-2009 at 11:37 AM. Reason: Automerged Doublepost
Pragadheesh is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 17-02-2009, 11:59 AM   #2 (permalink)
Dreaming Future
 
kin.vachhani's Avatar
 
Join Date: May 2005
Location: \internet\home
Posts: 177
Default Re: c# doubt in ArrayList

post the solution if u found it..
__________________
World without Computer is like a man without Brain.....
kin.vachhani is offline  
Old 17-02-2009, 01:40 PM   #3 (permalink)
In The Zone
 
Pragadheesh's Avatar
 
Join Date: Jul 2006
Location: Coimbatore
Posts: 403
Default Re: c# doubt in ArrayList

something like this.
((ArrayList)alMix[i])[j]

if we type cast into arraylist its working fine.

link:
http://www.dreamincode.net/forums/showtopic43999.htm
Pragadheesh is offline  
Old 17-02-2009, 05:23 PM   #4 (permalink)
Dreaming Future
 
kin.vachhani's Avatar
 
Join Date: May 2005
Location: \internet\home
Posts: 177
Default Re: c# doubt in ArrayList

thx bro...
__________________
World without Computer is like a man without Brain.....
kin.vachhani is offline  
Old 17-02-2009, 08:11 PM   #5 (permalink)
In The Zone
 
Pragadheesh's Avatar
 
Join Date: Jul 2006
Location: Coimbatore
Posts: 403
Default Re: c# doubt in ArrayList

u r welcome..[]
Pragadheesh is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Doubt In C Kulz Programming 10 29-09-2008 10:05 PM
Doubt on Ram aneeshkj Hardware Q&A 5 18-04-2007 08:32 PM
RAM doubt shariq_pj Hardware Q&A 3 16-11-2006 12:05 AM
Doubt Trinity QnA (read only) 2 01-05-2006 07:42 PM
VB Doubt ? Dipen01 QnA (read only) 12 22-08-2005 12:46 PM

 
Latest Threads
- by gforz
- by soumya
- by Sujeet
- by icebags
- by Charan

Advertisement




All times are GMT +5.5. The time now is 03:07 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2