Visual C# Novice

Can anyone suggest the best Collection Class to store a large list of string variables. A list with an amount over 100,000,000 strings. Ive tried so many ways but my program always slows down and my computer runs out of memory.


Re: Visual C# General Huge String List

Peter Ritchie

There are no in-memory collections that would suffice without huge amounts of memory to support it. I would suggest either using a database or cache a subset of the strings to disk.

You could write a custom collection to make the caching to disk transparent; but I haven't seen anything pre-built for that.






Re: Visual C# General Huge String List

Visual C# Novice

Ok. Thank you for you fast reply. It is greatly appreciated. But I did find a Collection Class to support such a large amount of data. Within the System.Collections.Specialized NameSpace. The HybridDictionary works wonders.




Re: Visual C# General Huge String List

Peter Ritchie

HybridDictionary is good if you're not sure if you'll have lots of data. If you know you'll have lots of data, Hashtable is a better choice over ListDictionary. This is what HybridDictionary does for you.

Still, you'll still need huge amounts of committed virtual memory to support that many strings; I doubt keeping them all in memory is required by your application.






Re: Visual C# General Huge String List

OmegaMan

Visual C# Novice wrote:
Can anyone suggest the best Collection Class to store a large list of string variables. A list with an amount over 100,000,000 strings. Ive tried so many ways but my program always slows down and my computer runs out of memory.


Paging the data may be the answer...but how are you getting the strings in the first place ... a database If it is SQL 2005 db check out the sample for paging in the Data Access section of 101 Samples for Visual Studio 2005. If you are getting them from files you may need to implement a way of paging the data that makes sense for your situation.