I trying to create a jagged array of two arrays, with the second array being
an array of two-dimensional arrays.
A graphical representation might look like this:
x y[a,b] y[a,b] y[a,b]
x y[a,b]
x y[a,b] y[a,b]
x y[a,b] y[a,b] y[a,b] y[a,b]
I can initialize a jagged array of arrays like this:
string[][] str = new string[][]
{
new string[] {"loop for strings"},
new string[] {"loop for strings"},
};
which would give me this:
x y y y
x y
x y y
x y y y y
but how do I initialize the 2-Dim array on the "y" array?
I tried this:
string[][][,] str = new string[][][,]
{
new string[] {"loop for strings"},
new string[] {{"loop for strings"},
new string[,] {{"strD-1"}, {"strD-2"}}}
};
but no luck.
how do I initialize this type of array?
Thanks in advance. 2 6168
deko <de**@nospam.com> wrote: I trying to create a jagged array of two arrays, with the second array being an array of two-dimensional arrays.
A graphical representation might look like this:
x y[a,b] y[a,b] y[a,b] x y[a,b] x y[a,b] y[a,b] x y[a,b] y[a,b] y[a,b] y[a,b]
<snip>
I tried this:
string[][][,] str = new string[][][,]
No - that's creating an array of arrays of rectangular arrays of
strings.
If you want something with a string and then an array of pairs, I
suggest you encapsulate that into your own type.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
>> string[][][,] str = new string[][][,] No - that's creating an array of arrays of rectangular arrays of strings.
I think it might be something more like this (still pseudo code):
string[][][,] str = new string[3][][,]
str[0] = new string[2][,]
str[0][0] = new string[,] { { "str00a" }, { "str00b" } }
str[0][1] = new string[,] { { "str01a" }, { "str01b" } }
str[1] = new string[1][,]
str[1][0] = new string[,] { { "str10a" }, { "str10b" } }
str[2] = new string[1][,]
str[2][0] = new string[,] { { "str20a" }, { "str20b" } }
which is intented to be a jagged array of multidimensional arrays.
But I'm not sure what the correct syntax is, and how I would fill such a
thing in a loop.
If you want something with a string and then an array of pairs, I suggest you encapsulate that into your own type.
Yes, that makes sense. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: James dean |
last post by:
I done a test and i really do not know the reason why a jagged array who
has the same number of elements as a multidimensional array is faster
here is my test. I assign a value and do a small...
|
by: Ravi Singh (UCSD) |
last post by:
Hello all
I am trying to use jagged and multi-dimensional arrays in C++.
In C# these work fine
// for jagged arrays
string jaggedArray = new string ;
//for multidimensional arrays
string...
|
by: Benny Raymond |
last post by:
Basically what the subject says...
"in a bool 2d array, does Initialize set everything to false?"
|
by: xllx.relient.xllx |
last post by:
Hi, I have two questions:
1.)Is it true that an rectangular array is really just an single
dimensional array that lets itself be treated as a multi-dimensional
array?
For example the...
|
by: Alan Foxmore |
last post by:
Hi everyone,
I'm new to C# and I was hoping I could get some clarification on the
syntax for jagged and multidimensional arrays.
Here is my question:
The following syntax is correct for...
|
by: tiberiu.motoc |
last post by:
Hi.
I've asked this question on the MSDN forums, but I've had no replies.
I'm really stuck, so I'm gonna try my luck here.
I have a Java web service which contains a simple function; the...
|
by: TS |
last post by:
is there some code somewhere that does this?
i have a jagged array that is not jagged, it has an equal number of rows and
columns in each array so it should convert but want to get the code to do...
|
by: =?Utf-8?B?U2hhcm9u?= |
last post by:
Hi Gurus,
I need to transfer a jagged array of byte by reference to unmanaged
function, The unmanaged code should changed the values of the array, and when
the unmanaged function returns I need...
|
by: pinkfloydfan |
last post by:
Hi there
I have a C# program that produces a lot of data that I currently store
in a jagged array and I have a couple of questions that I was hoping
someone might shed some light on for me...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |