473,395 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

dynamic array

Hi all,
I am wondering whether any of you knows how to initialize a dynamically
sized multi-dimensional array? I can't use arrayLists, hashtables, or
anything that is key value pair set-up... I need multi-dimensional array in
C#...it is asking me to initialize it with size when I write :

string[,,] myarray = new string[,,];

any suggestions are appreciated,

Thanks,

- Maji
Nov 15 '05 #1
3 19075
majiofpersia wrote:
Hi all,
I am wondering whether any of you knows how to initialize a
dynamically sized multi-dimensional array? I can't use arrayLists,
hashtables, or anything that is key value pair set-up...
An ArrayList is a vector, not a key pair construct. It sounds perfect
for your needs.
string[,,] myarray = new string[,,];


If do you not know the size of your dimensions, the ArrayList will come
in handy as you can simply add another ArrayList to achieve your second
dimension at run time.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
Nov 15 '05 #2
Thanks for your responses,

If I am going to use arraylist ... how can I add items to a 3 dimensional
arraylist?

I like the class method suggested by Val as well .. I am just wondering
whether it is the only way ...

Thanks again,

- Maji
"Frank Oquendo" <fr****@acadx.com> wrote in message
news:#F**************@TK2MSFTNGP12.phx.gbl...
majiofpersia wrote:
Hi all,
I am wondering whether any of you knows how to initialize a
dynamically sized multi-dimensional array? I can't use arrayLists,
hashtables, or anything that is key value pair set-up...


An ArrayList is a vector, not a key pair construct. It sounds perfect
for your needs.
string[,,] myarray = new string[,,];


If do you not know the size of your dimensions, the ArrayList will come
in handy as you can simply add another ArrayList to achieve your second
dimension at run time.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com

Nov 15 '05 #3
majiofpersia wrote:
Thanks for your responses,

If I am going to use arraylist ... how can I add items to a 3
dimensional arraylist?


The ArrayList will accept any type of object so you can add an ArrayList
as an element of an existing ArrayList.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
Nov 15 '05 #4

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

Similar topics

6
by: Vasileios Zografos | last post by:
Hello, I have a function that generates some values (e.g. vertices in 2d space) the number of which I dont know. So, it could generate 20 vertices, 100 vertices, or even 1 vertex. void...
4
by: Scott Lyons | last post by:
Hey all, Can someone help me figure out how to pass a dynamic array into a function? Its been giving me some trouble, and my textbook of course doesnt cover the issue. Its probably something...
5
by: meyousikmann | last post by:
I am having a little trouble with dynamic memory allocation. I am trying to read a text file and put the contents into a dynamic array. I know I can use vectors to make this easier, but it has to...
8
by: Peter B. Steiger | last post by:
The latest project in my ongoing quest to evolve my brain from Pascal to C is a simple word game that involves stringing together random lists of words. In the Pascal version the whole array was...
6
by: Materialised | last post by:
Hi Everyone, I apologise if this is covered in the FAQ, I did look, but nothing actually stood out to me as being relative to my subject. I want to create a 2 dimensional array, a 'array of...
1
by: lemonade | last post by:
Hello! Can someone explain to me the difference between dynamic array of pointers vs dynamic array of objects by giving a real life example. Following is the code that I am using for dynamic...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
0
by: pjr | last post by:
Using VS2005, I dynamically create an event delegate. Code follows question. My method gets the event's parameters and passes them onto a common event handler. My delegate gets called when expected...
11
by: C C++ C++ | last post by:
Hi all, got this interview question please respond. How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Rgrds MA
13
by: kwikius | last post by:
Does anyone know what a C99 dynamic array is, and if it will be useable in C++? regards Andy Little
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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,...

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.