我已经能够以这种方式序列化IEnumerable:
[XmlArray("TRANSACTIONS")]
[XmlArrayItem("TRANSACTION", typeof(Record))]
public IEnumerable<BudgetRecord> Records
{
get
{
foreach(Record br in _budget)
{
yield return br;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我意识到现在我需要一个包含集合的字典Dictionary<string, RecordCollection>(RecordCollection实现IEnumerable).
我怎样才能做到这一点?