tags:

views:

947

answers:

3

What is the major difference between the three? Right now, I want to create a key/value pair using both string/string respectively. All three seem to have options I can use.

Edit: I just want to create a simple hash table - nothing really complex.

+5  A: 

The generic collections almost completely replace the base collections and Collections.Specialized. To really give the best recommendation we need to know more about what you want to do, but odds are you want System.Collections.Generic.Dictionary.

Joel Coehoorn
+3  A: 
  • System.Collections: containers that store references to System.Object types
  • System.Collections.Specialized: specialized versions of System.Collections for types other than System.Object (distinct collection types per specialization, each stored in assembly)
  • System.Collections.Generic: a replacement for the above two as the runtime will determine how to create the collection for the type you want stored in it (one collection type for all specializations).
Steve Guidi
+1  A: 

The answer is highly dependent on your usage. Without knowing details, I would say take a look at System.Collections.Specialized.NameValueCollection for string, string. System.Collections.Specialized & System.Collections.Generic are strongly typed, I think System.Collections is just left over from .NET 1.1.

Michael Valenty
Dictionary<string,string> > NameValueCollection
Joel Coehoorn