Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to collapse an array?

How to collapse an array?

Scheduled Pinned Locked Moved C#
tutorialdatabasedata-structureshelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Yannielsen
    wrote on last edited by
    #1

    Hi there. I'm fiddling around with arrays and i need to collapse (re-arrange) an array. Currently i have no clue how to do it, so if anyone could help out with a little example or some hints i would be thankful. An example of what i want to do: --------------------------------- An array containing 5 elements 1 - 2 - 3 - 4 - 5 If i remove element index 3 from the array i want the index of element 4 to change to 3 and the index of element 5 to chance to 4. How is this possible? Thanks alot in advance!

    D E 2 Replies Last reply
    0
    • Y Yannielsen

      Hi there. I'm fiddling around with arrays and i need to collapse (re-arrange) an array. Currently i have no clue how to do it, so if anyone could help out with a little example or some hints i would be thankful. An example of what i want to do: --------------------------------- An array containing 5 elements 1 - 2 - 3 - 4 - 5 If i remove element index 3 from the array i want the index of element 4 to change to 3 and the index of element 5 to chance to 4. How is this possible? Thanks alot in advance!

      D Offline
      D Offline
      Dan Neely
      wrote on last edited by
      #2

      Create a temp array, copy all the other elements to it, then assign the temp to the old array.

      1 Reply Last reply
      0
      • Y Yannielsen

        Hi there. I'm fiddling around with arrays and i need to collapse (re-arrange) an array. Currently i have no clue how to do it, so if anyone could help out with a little example or some hints i would be thankful. An example of what i want to do: --------------------------------- An array containing 5 elements 1 - 2 - 3 - 4 - 5 If i remove element index 3 from the array i want the index of element 4 to change to 3 and the index of element 5 to chance to 4. How is this possible? Thanks alot in advance!

        E Offline
        E Offline
        esjq
        wrote on last edited by
        #3

        Take a look at the ArrayList. :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups