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. ArrayList capacity

ArrayList capacity

Scheduled Pinned Locked Moved C#
helpquestion
10 Posts 6 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.
  • M Offline
    M Offline
    Meysam Mahfouzi
    wrote on last edited by
    #1

    Is it possible to store more than int numbers in ArrayList object. If so, how can we retrieve number of stored items? Notice that Count property is of type int, and this is my problem!:doh:


    Don't forget, that's

    Persian Gulf

    not Arabian gulf!

    F H 2 Replies Last reply
    0
    • M Meysam Mahfouzi

      Is it possible to store more than int numbers in ArrayList object. If so, how can we retrieve number of stored items? Notice that Count property is of type int, and this is my problem!:doh:


      Don't forget, that's

      Persian Gulf

      not Arabian gulf!

      F Offline
      F Offline
      Frank Olorin Rizzi
      wrote on last edited by
      #2

      I think I've read somehwere that this is a known limitation of the ArrayList. It may have been a book, it may be outdated as of the release of .NET 2003 or I may be wrong. But I recall something along the lines of "yes, you are limited to store [max int] items, but after all, if you have that many items, do you really want them in memory?" HTH, F.O.R.

      1 Reply Last reply
      0
      • M Meysam Mahfouzi

        Is it possible to store more than int numbers in ArrayList object. If so, how can we retrieve number of stored items? Notice that Count property is of type int, and this is my problem!:doh:


        Don't forget, that's

        Persian Gulf

        not Arabian gulf!

        H Offline
        H Offline
        Holger Persch
        wrote on last edited by
        #3

        Remember that int is 32bit in .NET. This should be enough number of objects to store in memory. Regards, Holger

        P 1 Reply Last reply
        0
        • H Holger Persch

          Remember that int is 32bit in .NET. This should be enough number of objects to store in memory. Regards, Holger

          P Offline
          P Offline
          Philip Fitzsimons
          wrote on last edited by
          #4

          ha ha - very funny!


          "When the only tool you have is a hammer, a sore thumb you will have."

          D 1 Reply Last reply
          0
          • P Philip Fitzsimons

            ha ha - very funny!


            "When the only tool you have is a hammer, a sore thumb you will have."

            D Offline
            D Offline
            David Stone
            wrote on last edited by
            #5

            What was funny about that? :confused:


            I passionately hate the idea of being with it, I think an artist has always to be out of step with his time. -Orson Welles

            P 1 Reply Last reply
            0
            • D David Stone

              What was funny about that? :confused:


              I passionately hate the idea of being with it, I think an artist has always to be out of step with his time. -Orson Welles

              P Offline
              P Offline
              Philip Fitzsimons
              wrote on last edited by
              #6

              that an int is big enough.... try reading a large binary file.... byte[] BinaryReader.GetBytes(int count) I mean what stupid idiot thought that you would never want to read more than int.max? whay not a long?????? :doh:


              "When the only tool you have is a hammer, a sore thumb you will have."

              L D 2 Replies Last reply
              0
              • P Philip Fitzsimons

                that an int is big enough.... try reading a large binary file.... byte[] BinaryReader.GetBytes(int count) I mean what stupid idiot thought that you would never want to read more than int.max? whay not a long?????? :doh:


                "When the only tool you have is a hammer, a sore thumb you will have."

                L Offline
                L Offline
                leppie
                wrote on last edited by
                #7

                Philip Fitzsimons wrote: I mean what stupid idiot thought that you would never want to read more than int.max? whay not a long?????? The same stupid idiot that knows one cannot address more than 16gb memory... :doh: BTW Streams work with long, thus one can set the position virtually anywhere within a Stream and read a normal 4k/8k byte array at a time. leppie::AllocCPArticle("Zee blog");

                1 Reply Last reply
                0
                • P Philip Fitzsimons

                  that an int is big enough.... try reading a large binary file.... byte[] BinaryReader.GetBytes(int count) I mean what stupid idiot thought that you would never want to read more than int.max? whay not a long?????? :doh:


                  "When the only tool you have is a hammer, a sore thumb you will have."

                  D Offline
                  D Offline
                  David Stone
                  wrote on last edited by
                  #8

                  I would be worried about an app that loaded that much data at once. It's far more efficient to load smaller chunks and deal with them individually rather than do it all at the same time.


                  youd ebtter bnot be taki8ng agvantage o f my mental abilites!1 -David Wulff one night over MSN while totally plastered

                  P M 2 Replies Last reply
                  0
                  • D David Stone

                    I would be worried about an app that loaded that much data at once. It's far more efficient to load smaller chunks and deal with them individually rather than do it all at the same time.


                    youd ebtter bnot be taki8ng agvantage o f my mental abilites!1 -David Wulff one night over MSN while totally plastered

                    P Offline
                    P Offline
                    Philip Fitzsimons
                    wrote on last edited by
                    #9

                    yes, but its mean if you want to caculate the hash for a large file you have to do alot of extra work..... though leppie did point out you can use a stream....


                    "When the only tool you have is a hammer, a sore thumb you will have."

                    1 Reply Last reply
                    0
                    • D David Stone

                      I would be worried about an app that loaded that much data at once. It's far more efficient to load smaller chunks and deal with them individually rather than do it all at the same time.


                      youd ebtter bnot be taki8ng agvantage o f my mental abilites!1 -David Wulff one night over MSN while totally plastered

                      M Offline
                      M Offline
                      Meysam Mahfouzi
                      wrote on last edited by
                      #10

                      David Stone wrote: It's far more efficient to load smaller chunks and deal with them individually rather than do it all at the same time. Yes, that is true when all objects are available before runtime(and stored somewhere). But what if all our required objects should be created at run-time, and be stored in memory? maybe I should create an ArrayList of Arraylists if needed!:doh:


                      Don't forget, that's

                      Persian Gulf

                      not Arabian gulf!

                      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