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. array

array

Scheduled Pinned Locked Moved C#
tutorialdatabasedata-structuresquestion
4 Posts 4 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.
  • C Offline
    C Offline
    cst_kvp
    wrote on last edited by
    #1

    I want to delete the last index array value? it is possible or not? for example t is an PointF array. it contains 5 values but i need only 4 values for calculation. how to delete the last index value?

    PointF[] t = {{120,200},{300,400},{500,550},{890,900},{900,900}};

    i need only t[] = {{120,200},{300,400},{500,550},{890,900}}

    N S 2 Replies Last reply
    0
    • C cst_kvp

      I want to delete the last index array value? it is possible or not? for example t is an PointF array. it contains 5 values but i need only 4 values for calculation. how to delete the last index value?

      PointF[] t = {{120,200},{300,400},{500,550},{890,900},{900,900}};

      i need only t[] = {{120,200},{300,400},{500,550},{890,900}}

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      You can't resize an array. Copy the needed contents from this array to a new one.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

      R 1 Reply Last reply
      0
      • C cst_kvp

        I want to delete the last index array value? it is possible or not? for example t is an PointF array. it contains 5 values but i need only 4 values for calculation. how to delete the last index value?

        PointF[] t = {{120,200},{300,400},{500,550},{890,900},{900,900}};

        i need only t[] = {{120,200},{300,400},{500,550},{890,900}}

        S Offline
        S Offline
        Simon P Stevens
        wrote on last edited by
        #3

        You can't delete values from arrays, the only way is to recreate the array 1 size smaller and copy the values you want to keep. (Or just set the values you don't want to 0 or null and ignore them when you process the array). Best thing to do is use a generic collection. collections can be resized by calling add/delete. try:List<PointF> t = new List<PointF>();

        Simon

        1 Reply Last reply
        0
        • N N a v a n e e t h

          You can't resize an array. Copy the needed contents from this array to a new one.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

          R Offline
          R Offline
          Rao Rafique
          wrote on last edited by
          #4

          Just loop through the first 4 indexes...and use them for calculations.. ok..

          "Programming is a fun"

          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