3 dim array to 2 dim array in C#

Hi there;

I have 3 dim array and want to convert this to 2 dim array.

in which  the first dimension is consisting fixed value, and I want to combine the other 2 dims to a one dim.

How to do?

LVL 12
Who is Participating?
Julian HansenConnect With a Mentor Commented:
Ok then you have something like this

Open in new window

It would help to know why you want to combine these - for what purpose?
You could just concatenate all the strings together
    "one_one one_one_one one_one_two one_one_three one_two one_two_one one_two_two one_two_three one_three one_three_one one_three_two one_three_three"

Open in new window

But that might not make any sense

Or you could separate the subkeys with comma's or pipes etc

Before going into code - it would help to understand what you are aiming for - why you want to do this?
Julian HansenCommented:
How do you want to combine the second and third dims?
jazzIIIloveAuthor Commented:
i am thinking using a link query or so. couldn't sort it out.

the array consists of string elements. Any tips..
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Julian HansenCommented:
Before we get into tips - we need to know how you want to collapse the second and third arrays. Each element in the second array could potentially have more than one element - do you just want to concatenate them all together?
jazzIIIloveAuthor Commented:
it's [3][3][3] same type. Only one element each.

I am open to suggestions.

jazzIIIloveAuthor Commented:

I find 3 dim array costly in performance, that's the reason why i want to flatten it

Julian HansenCommented:
Yes understood - but HOW do you want to flatten it.

An array usually exist for a reason - without knowing how it is going to be used in its flattened state - we can't help you.

If you don't provide info in response to questions we can't help you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.