问题描述
我有一个包含一些私有和公共字段和属性的类。
[MessagePackObject(false)]
public class Person
{
[Key(1)]
public string Name { get; set; }
[IgnoreMember]
private int _age;
[Key(2)]
public int Age { get { return _age; } set { _age = value; } }
}
在某些情况下我不需要序列化Age
,我只需要序列化一些字段(例如只有Name
)。所以我需要两种方法,序列化所有对象和部分序列化。我该如何组织?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)