0
我有一個需要序列化的對象。
對象序列化:排除序列化到Json字符串的屬性 - DynamicJson
public class Setting
{
// Exclude from serialization
private SettingInfo _key;
public SettingInfo Key
{
get { return _key; }
set
{
_key = value;
Key_Id = _key == null ? 0 : _key.Id;
}
}
// Need to be serialized
public int Key_Id { get; set; }
public string Value { get; set; }
}
問:
是否可以排除使用DynamicJson
的SettingInfo
對象(房產Key
)從序列化?
- 我使用
DynamicJson
- 當前結果:(其中包含序列化
Key
屬性)
{"Key":{"Id":20,"Type":"System.String","Name":"ExampleSetting"},
"Key_Id":20,
"Value":"New Value"} - 請求的結果:
{"Key_Id":20,"Value":"New Value"}
這不完全是我想要的,但它的工作原理。謝謝 – hwcverwe 2012-01-16 22:47:37