tags:

views:

84

answers:

2

Does anyone know of a .NET array class/library which will page its contents out to disk?

The idea is to be able to use it as a normal array but the class uses less RAM (to avoid getting out-of-memory exceptions with more than 2GB of data). Ideally the class will implement one of:

  • System.Collections.Generic.IList
  • System.Collection.IList

So it will easily slot into existing code – and hopefully work with a DataGridView (although I may still need to implement “Virtual Mode”).

Any ideas much appreciated!

+2  A: 

I haven't come across anything like that, but I guess that's because it's rarely needed. After all, a database table (in SQL Server or any other database) is in essence a disk-based array.

You could write an IList<> wrapper around a database table. Throw in some caching and you have a perfect disk-based array.

Philippe Leybaert
+2  A: 

Unless you're dealing with fixed length records (and even then there's issues) you're going to run into a lot of problems with treating 2GB of data like an array that make a lot of array uses perform horribly -

  • IndexOf()
  • InsertAt()
  • RemoveAt()
  • Sort()

Is there any reason a database wouldn't work?

Tom
Hi,Thanks for your points and I do understand potential performance impacts - especially IndexOf(). The others such as RemoveAt() could be fast depending upon the implementation because e.g. the class could remove the row from it's interal index but leave the row on disk (avoiding a reshuffle but ultimately consuming unnecessary space).The application runs locally on a desktop with no access to SQL Server. I was considering a local Compact DB but it isn't that feasible with the codebase I already have (a lot of reworking).
Ben Breen