c# - 如何使用 Newtonsoft.Json 反序列化包含抽象类属性的对象
问题描述
我需要将 json 字符串转换为类型的对象FullArticle
;ArticleBody
(类中的 属性FullArticle
)是一个抽象类。
如何将其反序列化为具体类?我知道 HtmlBody 已经实现了ArticleBody
。
public class FullArticle : ArticleListItem
{
public string ShortDescription { get; set; }
// ToDo Check this for removal
public bool IsDone { get; private set; }
public ArticleBody Body { get; }
public long ViewCount { get; }
public string Keywords { get; }
}
解决方案
推荐阅读
- mongodb - 如何在 Spring Data mongo 中查询生日
- vb.net - 如何在一个 MsgBox() 中显示多条消息?[VB.NET]
- css - 如何使用 CSS 将填充应用于包装文本?
- python - Memcached 自动反映内置用户模型的变化,如何?
- python-3.x - 在python中读取十六进制文件(.dat)时如何识别文件中的当前位置?
- c# - UWP listview 多个 ItemContainerStyle
- jquery - initAutocomplete 不是一个函数(在本地机器上工作,但在实时服务器中部署时显示问题)
- scala - 声明一个在 Scala 中不返回的函数
- javascript - 如何在jquery的文本中添加css请给我参考
- android - 在 submitList 之后没有获得 PagedListAdapter 的 itemCount