3

Are there any valid uses for the classes in the System.Collections.Specialized namespace any more or are they all superseded by the classes in the System.Collections.Generic, System.Collections.Concurrent and System.Collections.ObjectModel namespace now?

The classes in the namespace are:

HybridDictionary
ListDictionary
NameValueCollection
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator

Similarly, are there any real reasons why one might use the non-generic System.Collections namespace classes such as:

ArrayList
BitArray
Hashtable
Queue
SortedList
Stack

1 Answer 1

5

For new code there isn't any particular value -- by and large they are around for backwards compatibility concerns -- NameValueCollection is deeply embedded in significant parts of ASP.NET for example. Many venerable libraries are using the non-generic and specialized collections internally. Some of the specialized collections don't have a direct generic equivalent though one can usually get there without too much trouble.

From a maintenance overhead point of view they aren't maintenance hassles, once you've got a working ListDictionary implementation how much is it going to change with updates to the CLR?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.