0

I have a 2 dimensional array.
Like,
(0,1)
(0,2)
(0,3)
(1,1)
(1,2)
(1,3)
(2,1)
(2,2)
(2,3)

How can i use Array.Copy to copy only the 2nd index in a new array.
Like only,
(2,1)
(2,2)
(2,3)

Or is there any other way.

8
  • You could use a foreach construction.. but that is probably not realy effcient. Commented Aug 28, 2013 at 9:40
  • @BartTeunissen not really efficient? There are not too many things more efficient than looping through simple arrays. There you have a link (in C# but instructive anyway): stackoverflow.com/questions/7483893/… Commented Aug 28, 2013 at 10:00
  • I understand that thats the case, but a foreach loop is more than one line of code, and i wasn't sure if there was an easier sollution.. that is what is was trying to say. Commented Aug 28, 2013 at 10:02
  • @varocarbas...please suggest an answer...not able to conclude with the link Commented Aug 28, 2013 at 10:03
  • 1
    @BartTeunissen All clear. But some times, lines of code and efficiency are mixed up: a lower number of lines does not mean higher efficiency. A single line can call a really complex set of functions. For example, the "simple" arrays require more lines of code than "more complex" collection (e.g., List); but they are much more efficient as far as the complex collections need more resources to perform each single action. Commented Aug 28, 2013 at 10:05

1 Answer 1

0

Array.copy( source_array, 6, destin_array, )

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.