Wednesday 11 December 2013

Warning: Relevance of System.Collections.Specialized Diminished in a Post-.NET-Generics World

This namespace (System.dll) surfaced early in .NET 1.1. and the classes and structures have remained pretty much the same since. There have been some tweaks in terms of new interfaces and delegates, but by and large, this namespace has remained fairly static. In the post-.NET-generics world it's relevance has waned somewhat but it still contains some useful and interesting abstractions, for which even the .NET 4.5 programmer can achieve rewards.

Of all the classes, StringDictionary, a dictionary whose keys and values are strings, is the most easy and obvious to use, and maybe is a bit neater than using System.Collections.Generic in this specific case.

The namespace also has ListDictionary intended to have superior performance than a Hashtable for a small number of items (less than 10) by using a singly-linked list to implement the IDictionary interface.

No comments: