0

假设我有这样的课程:

class A
{
    Dictionary<string, string> Dict1 { get; set }
}

我希望它像这样序列化为 Json:

"A" : {"strKey1" : "strVal1", "strKey2" : "strVal2"}

代替:

"A" : { "Dict1" : {"strKey1" : "strVal1", "strKey2" : "strVal2"}}

可以这么说,我想跳过生成“Dict1”键。

是否可以?

或者,如何强制序列化“自定义”字典成员?当我这样写我的课时:

class A : Dictionary<string, string> 

他们字典的键/值对没有被序列化......

先感谢您!

4

1 回答 1

0

我自己搞定了——自定义序列化。

于 2012-03-02T17:16:29.560 回答