473,412 Members | 1,873 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,412 software developers and data experts.

Multidimensional arrays? any other options?

Hi there,

Just wondering, if there is any way to have a dynamic / unspecified size of
an array? It obviously needs to be updated, deleted etc. The only way I
thought is by making the array massive at the start? Any other ideas?
Apparently Hashtable, ArrayList etc are useless as they all take one
dimension. :( Please help me!

Thanks,
Naomi
Nov 16 '05 #1
3 1769
1. You can put hashtables into hastables (to any depth you want) to get
multi-dimensional-hashtables.
2. The same, of course, applies to ArrayLists.
3. ArrayList's don't really "grow": If you break the size limits of an
ArrayList, it will allocate a bigger block of memory, copy all the data, and
free the old block, this is merely hidden away inside the class - you can of
course do the same in your code.
4. If you really need a the data structure that can increase its size
without reallocation, you'll have to use a linked list, but that will
probably not give you any performance benefit unless you frequently
insert/remove items in the beginning/middle of your list. (AFAIK garbage
collectors don't like linked lists)

Hope this helps

Niki
"Naomi" <no*******@goaway.xyz> wrote in news:c8**********@lust.ihug.co.nz...
Hi there,

Just wondering, if there is any way to have a dynamic / unspecified size of an array? It obviously needs to be updated, deleted etc. The only way I
thought is by making the array massive at the start? Any other ideas?
Apparently Hashtable, ArrayList etc are useless as they all take one
dimension. :( Please help me!

Thanks,
Naomi

Nov 16 '05 #2
I feel your pain. C# doesn't have a way of defining a multi-dimential
dynamic unspecified size array. It is one the worst limitations that I have
come across in C#. I think they definitely need to address this problem in
the next version of C#.

Best of luck,

Amadelle

"Naomi" <no*******@goaway.xyz> wrote in message
news:c8**********@lust.ihug.co.nz...
Hi there,

Just wondering, if there is any way to have a dynamic / unspecified size of an array? It obviously needs to be updated, deleted etc. The only way I
thought is by making the array massive at the start? Any other ideas?
Apparently Hashtable, ArrayList etc are useless as they all take one
dimension. :( Please help me!

Thanks,
Naomi

Nov 16 '05 #3
Amadelle <sy******@intellitime.com> wrote:
I feel your pain. C# doesn't have a way of defining a multi-dimential
dynamic unspecified size array. It is one the worst limitations that I have
come across in C#. I think they definitely need to address this problem in
the next version of C#.


It's not really a C# limitation - it's a .NET limitation, and one which
naturally comes from arrays of all types being fixed in size. That is a
limitation in some ways, but a great benefit in others (notably
performance - I believe various optimisations can be performed if you
know that the size isn't going to change).

Generics will help to some extent, in terms of having an ArrayList of
ArrayLists without having to cast all over the place. It still won't be
*really* straightforward, but better than it is now.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4

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

Similar topics

0
by: Wihlelm Bierbaum | last post by:
I'm trying to make use of a certain method of a COM object that takes a multidimensional array as its sole parameter. Here's an example of the construction of said array: $cA = array(); $cA =...
5
by: TLOlczyk | last post by:
I have a brain cramp and I need some help. I have a chunk of code below which demonstrates a problem I have with multidimensional arrays. I want to keep it simple but something specific is...
9
by: Charles Banas | last post by:
i've got an interesting peice of code i'm maintaining, and i'd like to get some opinions and comments on it, hopefully so i can gain some sort of insight as to why this works. at the top of the...
4
by: Kobu | last post by:
I've read the FAQ and several posts on multidimensional arrays and how their names decay to pointer to arrays (not pointer to pointers). If this is so, why does the following code fragment...
3
by: Claire | last post by:
I have a multidimensional array defined as private double myArray = new double; The first column of the array contains X values, the other contains Y values I have a charting function defined as...
21
by: utab | last post by:
Hi there, Is there a way to convert a double value to a string. I know that there is fcvt() but I think this function is not a part of the standard library. I want sth from the standard if...
10
by: | last post by:
I'm fairly new to ASP and must admit its proving a lot more unnecessarily complicated than the other languages I know. I feel this is because there aren't many good official resources out there to...
2
by: oopsatwork | last post by:
Ok...so, I have been outside of the C world for a _very_ long time...but not so long as to remember how to do multidimensional arrays. So, let me state that I know how to malloc pointers to...
0
by: Szabolcs Borsanyi | last post by:
Dear All, there have been several threads on multidimensional arrays and pointers to arrays, there is still something I could not fully understand. (My point here I have raised already, but...
9
by: Slain | last post by:
I need to convert a an array to a multidimensional one. Since I need to wrok with existing code, I need to modify a declaration which looks like this In the .h file int *x; in a initialize...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
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...

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.