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?

Regards.
LVL 12
jazzIIIloveAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
How do you want to combine the second and third dims?
0
jazzIIIloveAuthor Commented:
i am thinking using a link query or so. couldn't sort it out.

the array consists of string elements. Any tips..
0
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?
0
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

jazzIIIloveAuthor Commented:
it's [3][3][3] same type. Only one element each.

I am open to suggestions.

Regards.
0
Julian HansenCommented:
Ok then you have something like this
"one"
          "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"
"two"
          "two_one"
                         "two_one_one"
                         "two_one_two"
                         "two_one_three"
          "two_two"
                         "two_two_one"
                         "two_two_two"
                         "two_two_three"
          "two_three"
                         "two_three_one"
                         "two_three_two"
                         "two_three_three"
"three"
          "three_one"
                         "three_one_one"
                         "three_one_two"
                         "three_one_three"
          "tthree_two"
                         "three_two_one"
                         "three_two_two"
                         "three_two_three"
          "three_three"
                         "three_three_one"
                         "three_three_two"
                         "three_three_three"

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_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?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jazzIIIloveAuthor Commented:
Hi;

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

Regards.
0
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.