How to XML-serialize a dictionary
问题 I have been able to serialize an IEnumerable this way: [XmlArray("TRANSACTIONS")] [XmlArrayItem("TRANSACTION", typeof(Record))] public IEnumerable<BudgetRecord> Records { get { foreach(Record br in _budget) { yield return br; } } } However, I realised that now I need a dictionary containing a collection Dictionary<string, RecordCollection> (RecordCollection implements IEnumerable). How can I achieve that? 回答1: Take a look at the following blog post http://blogs.msdn.com/b/psheill/archive/2005