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. Dyanamic size of Array

Dyanamic size of Array

Scheduled Pinned Locked Moved C#
data-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.
  • C Offline
    C Offline
    cshivaprasad
    wrote on last edited by
    #1

    How can i declare/create a array, which have dynamic size. i mean dynamically the no of elements in array varies,.. Can u pls help me,. I want a string array of such kind.

    C G 2 Replies Last reply
    0
    • C cshivaprasad

      How can i declare/create a array, which have dynamic size. i mean dynamically the no of elements in array varies,.. Can u pls help me,. I want a string array of such kind.

      C Offline
      C Offline
      Corinna John
      wrote on last edited by
      #2

      That's what collections are there for. In C# 2.0: Collection dynamicArray = new Collection(); In C# 1.x: Use a collection generator to create a typesafe collection. _________________________________ Please inform me about my English mistakes, as I'm still trying to learn your language!

      1 Reply Last reply
      0
      • C cshivaprasad

        How can i declare/create a array, which have dynamic size. i mean dynamically the no of elements in array varies,.. Can u pls help me,. I want a string array of such kind.

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        Arrays can't be dynamic. Resizing an array means declaring a new array and copy all the elements to the new array. This is expensive, so there is intentionally no built in method to do this. There are many different collections that you can use depending on what you need, like ArrayList, HashTable, Queue, SortedList, et.c. --- b { font-weight: normal; }

        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