I’ve decided that I need to create a 64-bit List to fulfill some of my program’s needs, namely the ability to use longs as indexes. I’ve looked at the Mono code for implementing a List, and have come to the general conclusion that no matter what I choose, I should make a variation of IList (using longs) to work with it.
Now my question is, what do you think would be a good approach to this design? I am currently thinking of two possibilities -> since a List is just a wrapper for the Array class, I can just rewrite the List class to use giant arrays; or I can write the class to use a List of Lists to maintain and grow the data as needed. The problem with the first appears to be choosing an array that is too large, and the second is trying to make Remove() and other assorted methods work, when I’d probably need to perform massive memory copies to keep everything indexed properly. Your thoughts?
Since arrays are limited to be indexed by int you will have to use multiples of them anyway. I’d directly go for List of List. Note that all objects in CLR are limited by 2Gb single chunk of memory for allocation.
Side notes:
Here is link to more detailed discussion about large arrays.