XML serialization for Dictionary generic

For some reasons Microsoft made their generic Dictionary<TKey, TValue> class not XML-serializable. But making your own Dictionary that supports XML serialization is very simple. All you have to do is to write an implementation of IXmlSerializable interface.
(more…)

Tuesday, July 24th, 2007

Generic Pair .NET class

If you ever worked with C++ STL library you might remember pair template, which sometimes was very useful. .NET Framework has similar generic KeyValuePair<TKey, TValue>. But as it is designed to work with Dictionary class KeyValuePair has one sufficient constraint: it does not have public setters for Key and Value properties.

So I wrote my own generic Pair class and extended it with some useful static routines.
(more…)

Monday, July 16th, 2007