public static void Serialize(IDictionary dictionary, Stream stream) { DictionarySerializer ds = new DictionarySerializer(dictionary); XmlSerializer xs = new XmlSerializer(typeof(DictionarySerializer)); xs.Serialize(stream, ds); }