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

data type for 2 D data

Tem
What would be the best data type for storing objects in a 2D array.
the ideal type would be one like generic List but Lists are only 1D. i don't
think i can have an array of lists.
The size of either the row or column is given while the size of the other
dimension can be dynamically changed.

the data type needs to be optimized for performance, only sequential
add/remove is nessesary.

any suggestions?

Tem

Apr 7 '08 #1
8 1333
I just wanted to point out that List<List<object>is perfectly fine. It may
not apply to your situation where one dimension is fixed.

"Tem" wrote:
What would be the best data type for storing objects in a 2D array.
the ideal type would be one like generic List but Lists are only 1D. i don't
think i can have an array of lists.
Apr 8 '08 #2
Tem
thanks. let me try that.

how is it performance wise?

"Family Tree Mike" <Fa************@discussions.microsoft.comwrote in
message news:D9**********************************@microsof t.com...
>I just wanted to point out that List<List<object>is perfectly fine. It
may
not apply to your situation where one dimension is fixed.

"Tem" wrote:
>What would be the best data type for storing objects in a 2D array.
the ideal type would be one like generic List but Lists are only 1D. i
don't
think i can have an array of lists.
Apr 8 '08 #3
Pardon me if I do not understand the problem statement
But, wouldn't jagged array work

e.g. Person[][] mydata = new Person[9][];
mydata[0] = new Person[4];
mydata[1] = new Person[n];

HTH
Kalpesh

On Apr 7, 8:41 pm, "Tem" <tem1...@yahoo.comwrote:
thanks. let me try that.

how is it performance wise?

"Family Tree Mike" <FamilyTreeM...@discussions.microsoft.comwrote in
messagenews:D9**********************************@m icrosoft.com...
I just wanted to point out that List<List<object>is perfectly fine. It
may
not apply to your situation where one dimension is fixed.
"Tem" wrote:
What would be the best data type for storing objects in a 2D array.
the ideal type would be one like generic List but Lists are only 1D. i
don't
think i can have an array of lists.
Apr 8 '08 #4
Tem
I need to be able to change the size of the array as needed. can this be
done with jagged array?

<sh***********@gmail.comwrote in message
news:1f**********************************@e10g2000 prf.googlegroups.com...
Pardon me if I do not understand the problem statement
But, wouldn't jagged array work

e.g. Person[][] mydata = new Person[9][];
mydata[0] = new Person[4];
mydata[1] = new Person[n];

HTH
Kalpesh

On Apr 7, 8:41 pm, "Tem" <tem1...@yahoo.comwrote:
>thanks. let me try that.

how is it performance wise?

"Family Tree Mike" <FamilyTreeM...@discussions.microsoft.comwrote in
messagenews:D9**********************************@ microsoft.com...
>I just wanted to point out that List<List<object>is perfectly fine.
It
may
not apply to your situation where one dimension is fixed.
"Tem" wrote:
>What would be the best data type for storing objects in a 2D array.
the ideal type would be one like generic List but Lists are only 1D. i
don't
think i can have an array of lists.
Apr 8 '08 #5
That is an array of lists, and is a real pain to resize; you can't
change the array, and you'd need to change every list individually. If
you went down this route, a list of arrays (List<T[]>) would be a better
option - at least then you can just add a new T[] as a new row; it is
still jagged, however.

The linearized Matrix<TI posted earlier handles all this in a single
list, and allows you to have either axis pinned. You could probably
loser all the ITypedList stuff without too much pain, though ;-p

Marc
Apr 8 '08 #6
Cool, man !

Thanks for sharing it,
Apr 8 '08 #7
Agreed. I posted a response to what the poster had asked, I think, before I
saw your other post. I wanted the poster to see what was possible. I liked
(and prefered) your solution!

"Marc Gravell" wrote:
That is an array of lists, and is a real pain to resize; you can't
change the array, and you'd need to change every list individually. If
you went down this route, a list of arrays (List<T[]>) would be a better
option - at least then you can just add a new T[] as a new row; it is
still jagged, however.

The linearized Matrix<TI posted earlier handles all this in a single
list, and allows you to have either axis pinned. You could probably
loser all the ITypedList stuff without too much pain, though ;-p

Marc
Apr 8 '08 #8
Tem
wow thanks for sharing!

Does anyone know how to limit the capacity of a regular List<>?

"Marc Gravell" <ma**********@gmail.comwrote in message
news:%2***************@TK2MSFTNGP02.phx.gbl...
That is an array of lists, and is a real pain to resize; you can't change
the array, and you'd need to change every list individually. If you went
down this route, a list of arrays (List<T[]>) would be a better option -
at least then you can just add a new T[] as a new row; it is still jagged,
however.

The linearized Matrix<TI posted earlier handles all this in a single
list, and allows you to have either axis pinned. You could probably loser
all the ITypedList stuff without too much pain, though ;-p

Marc
Apr 8 '08 #9

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

Similar topics

4
by: Thomas Paul Diffenbach | last post by:
Can anyone point me to an open source library of /statically allocated/ data structures? I'm writing some code that would benefit from trees, preferably self balancing, but on an embedded system...
4
by: Dan | last post by:
I'm trying to creat a data structure, that can be either a integer, double, string, or linked list. So I created the following, but don't know if it is the data structure itself causing problems,...
11
by: mesut demir | last post by:
Hi All, When I create fields (in files) I need assign a data type like char, varchar, money etc. I have some questions about the data types when you create fields in a file. What is the...
4
by: toby989 | last post by:
Hi All Anyone came across this problem before? I have an X<L file created by excel <xml id="model"> <root> <Row>
18
by: Joel Hedlund | last post by:
Hi! The question of type checking/enforcing has bothered me for a while, and since this newsgroup has a wealth of competence subscribed to it, I figured this would be a great way of learning...
8
MMcCarthy
by: MMcCarthy | last post by:
Type MemSize RetVal of VarType() Declaration Char Conversion Boolean 2b vbBoolean(11) CBool() Byte 1b vbByte(17) ...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
19
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect...
10
by: oktayarslan | last post by:
Hi all; I have a problem when inserting an element to a vector. All I want is reading some data from a file and putting them into a vector. But the program is crashing after pushing a data which...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.